Skip to content

Commit 0602635

Browse files
committed
Debug/test date parsing
1 parent 100129d commit 0602635

File tree

3 files changed

+24
-2
lines changed

3 files changed

+24
-2
lines changed

LDK/resources/web/LDK/ConvertUtils.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ Ext4.ns('LDK');
44
* Static helpers designed to help with type conversion in JS.
55
*/
66
LDK.ConvertUtils = new function(){
7+
var verboseLogging = false;
8+
79
var DATEFORMATS = LABKEY.Utils.getDateAltFormats().split('|');
810
DATEFORMATS.push('Y/m/d H:i:s');
911
DATEFORMATS.push('n-j-Y');
@@ -40,6 +42,10 @@ LDK.ConvertUtils = new function(){
4042

4143
// Therefore special case this format and append the browser's time zone:
4244
if (format === 'c' && value.length === 10) {
45+
if (this.verboseLogging) {
46+
console.log('switching from c for Y-m-d format')
47+
}
48+
4349
format = 'Y-m-d';
4450
}
4551

@@ -48,6 +54,12 @@ LDK.ConvertUtils = new function(){
4854
result = Ext4.Date.clearTime(parsedDate);
4955
}
5056
}
57+
58+
if (this.verboseLogging) {
59+
console.log('Parsing, raw value: ' + value);
60+
console.log('format: ' + format);
61+
console.log(result);
62+
}
5163
return result;
5264
}
5365

@@ -113,6 +125,10 @@ LDK.ConvertUtils = new function(){
113125
}, this);
114126
}
115127
}, this);
128+
},
129+
130+
setVerboseLogging: function(val) {
131+
this.verboseLogging = val;
116132
}
117133
}
118134
};

LDK/test/src/org/labkey/test/tests/external/labModules/LabModulesTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1498,7 +1498,7 @@ private void samplesTableTest() throws Exception
14981498
Ext4FieldRef.getForLabel(this, "Comment").setValue("I removed these samples");
14991499

15001500
// TODO: for debugging date. ultimately remove
1501-
checker().withScreenshot("LabModulesTestDate1");
1501+
BaseWebDriverTest.getCurrentTest().getArtifactCollector().dumpPageSnapshot("LabModulesTestDate1");
15021502

15031503
// Debug date parsing
15041504
String clientFormattedString = (String)executeScript("return Ext4.Date.format(LDK.ConvertUtils.parseDate('2017-01-02'), 'Y-m-d');");
@@ -1520,7 +1520,7 @@ private void samplesTableTest() throws Exception
15201520
{
15211521
Assert.assertEquals("I removed these samples", row.get("remove_comment"));
15221522
Assert.assertEquals(getUserId(), row.get("removedby"));
1523-
Assert.assertEquals("2017-01-02", dateFormat.format(row.get("dateremoved")));
1523+
Assert.assertEquals("Incorrect date, raw value: " + row.get("dateremoved"), "2017-01-02", dateFormat.format(row.get("dateremoved")));
15241524
}
15251525
}
15261526

laboratory/resources/web/laboratory/window/AssaySpreadsheetImportWindow.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ Ext4.define('Laboratory.ext.AssaySpreadsheetImportWindow', {
6262
return;
6363
}
6464

65+
// TODO: debugging, ultimately remove this
66+
LDK.ConvertUtils.setVerboseLogging(true);
67+
6568
var models = LDK.StoreUtils.getModelsFromText({
6669
store: win.targetGrid.store,
6770
text: text
@@ -77,6 +80,9 @@ Ext4.define('Laboratory.ext.AssaySpreadsheetImportWindow', {
7780

7881
win.targetGrid.store.add(toAdd);
7982

83+
// TODO: debugging, ultimately remove this
84+
LDK.ConvertUtils.setVerboseLogging(false);
85+
8086
win.close();
8187
}
8288
},{

0 commit comments

Comments
 (0)