-
Notifications
You must be signed in to change notification settings - Fork 6
Fix dates mismatch issue where dates for observation’s displayed in the Graph and Table view’s don’t match the observation’s effectiveDateTime as received by the app from service. #17
Changes from 1 commit
120c20c
e14e9e4
158c8db
a940312
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -253,8 +253,9 @@ | |
|
||
$.each(model, function( index, data ) { | ||
//debugger; | ||
var dateString = data.hasOwnProperty('dateString') ? data.dateString : ''; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. check There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We wouldnt need to check |
||
var age = new GC.TimeInterval(patient.DOB).setMonths(data.agemos), | ||
date = new XDate(patient.DOB.getTime()).addMonths(data.agemos), | ||
date = new XDate(dateString), | ||
dateText = date.toString(GC.chartSettings.dateFormat);//, | ||
// years, | ||
// months, | ||
|
@@ -478,8 +479,8 @@ | |
{ | ||
label : "Date", | ||
get : function( entry/*, model*/ ) { | ||
return new XDate(patient.DOB.getTime()) | ||
.addMonths(entry.agemos) | ||
var dateString = entry.hasOwnProperty('dateString') ? entry.dateString : ''; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. check entry? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The So it should always be available. |
||
return new XDate(dateString) | ||
.toString(GC.chartSettings.dateFormat); | ||
}, | ||
style : "text-align:left" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,18 +19,25 @@ window.GC = window.GC || {}; | |
var out = {}; | ||
out.annotation = { txt : this.note }; | ||
out.agemos = patient.DOB.diffMonths(this.date + 1); | ||
if (this.hasOwnProperty('dateString')){ | ||
out.dateString = this.dateString; | ||
} | ||
return out; | ||
}; | ||
|
||
function SmartBoneage(date, boneAgeMos) { | ||
function SmartBoneage(date, boneAgeMos, dateString) { | ||
this.date = new XDate(date); | ||
this.boneAgeMos = boneAgeMos; | ||
this.dateString = dateString; | ||
} | ||
|
||
SmartBoneage.prototype.toGCBoneage = function(patient) { | ||
var out = {}; | ||
out.boneAge = this.boneAgeMos; | ||
out.agemos = patient.DOB.diffMonths(this.date + 1); | ||
if (this.hasOwnProperty('dateString')){ | ||
out.dateString = this.dateString; | ||
} | ||
return out; | ||
}; | ||
|
||
|
@@ -278,7 +285,8 @@ window.GC = window.GC || {}; | |
agemos: o.hasOwnProperty("agemos") ? | ||
o.agemos : | ||
patient.DOB.diffMonths(new XDate(o.date)), | ||
value : o.value | ||
value : o.value, | ||
dateString: o.dateString | ||
}); | ||
} | ||
|
||
|
@@ -336,6 +344,9 @@ window.GC = window.GC || {}; | |
|
||
if (boneAgeList && boneAgeList.length) { | ||
$.each(boneAgeList, function(i, o) { | ||
if (o.hasOwnProperty("boneAgeMos") && o.hasOwnProperty("date") && o.hasOwnProperty("dateString")) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. check o? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. $.each will guarantee that |
||
o = new SmartBoneage(o.date, o.boneAgeMos, o.dateString); | ||
} | ||
if (o instanceof SmartBoneage) { | ||
patient.boneAge.push(o.toGCBoneage(patient)); | ||
} else { | ||
|
@@ -475,6 +486,9 @@ window.GC = window.GC || {}; | |
model[ o.agemos ].lengthAndStature = o.value; | ||
} else { | ||
model[ o.agemos ] = { "lengthAndStature" : o.value }; | ||
if (o.hasOwnProperty('dateString')) { | ||
model[ o.agemos ]['dateString'] = o.dateString; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fix the spaces There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed. |
||
} | ||
} | ||
}); | ||
|
||
|
@@ -484,6 +498,9 @@ window.GC = window.GC || {}; | |
model[ o.agemos ].weight = o.value; | ||
} else { | ||
model[ o.agemos ] = { "weight" : o.value }; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove spaces in [] There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed in the entire file. |
||
if (o.hasOwnProperty('dateString')) { | ||
model[ o.agemos ]['dateString'] = o.dateString; | ||
} | ||
} | ||
}); | ||
|
||
|
@@ -494,6 +511,9 @@ window.GC = window.GC || {}; | |
} else { | ||
model[ o.agemos ] = { "headc" : o.value }; | ||
} | ||
if (!model[o.agemos].hasOwnProperty("dateString") && o.hasOwnProperty('dateString')) { | ||
model[ o.agemos ]['dateString'] = o.dateString; | ||
} | ||
}); | ||
|
||
// BMI | ||
|
@@ -503,6 +523,9 @@ window.GC = window.GC || {}; | |
} else { | ||
model[ o.agemos ] = { "bmi" : o.value }; | ||
} | ||
if (!model[o.agemos].hasOwnProperty("dateString") && o.hasOwnProperty('dateString')) { | ||
model[ o.agemos ]['dateString'] = o.dateString; | ||
} | ||
}); | ||
|
||
// Bone Age | ||
|
@@ -512,6 +535,9 @@ window.GC = window.GC || {}; | |
} else { | ||
model[ o.agemos ] = { "boneAge" : o.boneAge }; | ||
} | ||
if (!model[o.agemos].hasOwnProperty("dateString") && o.hasOwnProperty('dateString')) { | ||
model[ o.agemos ]['dateString'] = o.dateString; | ||
} | ||
}); | ||
|
||
// Annotations | ||
|
@@ -521,12 +547,18 @@ window.GC = window.GC || {}; | |
} else { | ||
model[ o.agemos ] = { "annotation" : o.annotation }; | ||
} | ||
if (!model[o.agemos].hasOwnProperty("dateString") && o.hasOwnProperty('dateString')) { | ||
model[ o.agemos ]['dateString'] = o.dateString; | ||
} | ||
}); | ||
|
||
// Override with custom scratchpad data if available | ||
if (GC._isPatientDataEditable && GC.scratchpadData && GC.scratchpadData.patientData) { | ||
$.each(GC.scratchpadData.patientData, function(i, o) { | ||
model[ o.agemos ] = o; | ||
if (!model[o.agemos].hasOwnProperty("dateString") && o.hasOwnProperty('dateString')) { | ||
model[ o.agemos ]['dateString'] = o.dateString; | ||
} | ||
}); | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you need to check
entry
object?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We wouldnt need to check
entry
since its an object in the array and we are doing a $.each on the array.