Fix duplicate lesion bug LT-110
This commit is contained in:
parent
d912c7a269
commit
e4547f121d
@ -56,7 +56,6 @@ var LesionManager = (function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (lesionData.isTarget === true) {
|
if (lesionData.isTarget === true) {
|
||||||
// TODO = Add short axis
|
|
||||||
timepointData.shortestDiameter = lesionData.widthMeasurement;
|
timepointData.shortestDiameter = lesionData.widthMeasurement;
|
||||||
timepointData.longestDiameter = lesionData.measurementText;
|
timepointData.longestDiameter = lesionData.measurementText;
|
||||||
} else {
|
} else {
|
||||||
@ -86,8 +85,8 @@ var LesionManager = (function() {
|
|||||||
// Set a flag to prevent duplication of toolData
|
// Set a flag to prevent duplication of toolData
|
||||||
measurement.toolDataInsertedManually = true;
|
measurement.toolDataInsertedManually = true;
|
||||||
|
|
||||||
// Increment and store the Lesion Number for this Measurement
|
// Increment and store the absolute Lesion Number for this Measurement
|
||||||
measurement.lesionNumber = Measurements.find().count() + 1;
|
measurement.lesionNumberAbsolute = Measurements.find().count() + 1;
|
||||||
|
|
||||||
// Insert this into the Measurements Collection
|
// Insert this into the Measurements Collection
|
||||||
// Save the ID into the toolData (not sure if this works?)
|
// Save the ID into the toolData (not sure if this works?)
|
||||||
@ -114,36 +113,38 @@ var LesionManager = (function() {
|
|||||||
*/
|
*/
|
||||||
function getNewLesionNumber(timepointID, isTarget) {
|
function getNewLesionNumber(timepointID, isTarget) {
|
||||||
// Get all current lesion measurements
|
// Get all current lesion measurements
|
||||||
|
var numMeasurements = Measurements.find({
|
||||||
|
isTarget: isTarget
|
||||||
|
}).count();
|
||||||
|
|
||||||
|
// If no measurements exist yet, start at 1
|
||||||
|
if (!numMeasurements) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Find related measurements (i.e. target or non-target)
|
||||||
var measurements = Measurements.find({
|
var measurements = Measurements.find({
|
||||||
isTarget: isTarget
|
isTarget: isTarget
|
||||||
}, {
|
}, {
|
||||||
sort: {lesionNumber: 1}
|
sort: {lesionNumber: 1}
|
||||||
}).fetch();
|
});
|
||||||
|
|
||||||
// If no measurements exist yet, start at 1
|
|
||||||
if (!measurements.length) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If measurements exist, find the last lesion number
|
// If measurements exist, find the last lesion number
|
||||||
// from the given timepoint
|
// from the given timepoint
|
||||||
var lesionNumberCounter = 1;
|
var lesionNumberCounter = 1;
|
||||||
var numMeasurements = measurements.length;
|
|
||||||
|
|
||||||
// Search through Measurements to see which ones
|
// Search through Measurements to see which ones
|
||||||
// already have data for this Timepoint
|
// already have data for this Timepoint
|
||||||
for (var i = 0; i < numMeasurements; i++) {
|
measurements.forEach(function(measurement) {
|
||||||
var measurement = measurements[i];
|
|
||||||
|
|
||||||
// If this measurement has no data for this Timepoint,
|
// If this measurement has no data for this Timepoint,
|
||||||
// use this as the current Measurement
|
// use this as the current Measurement
|
||||||
if (!measurement.timepoints[timepointID]) {
|
if (!measurement.timepoints[timepointID]) {
|
||||||
return measurement.lesionNumber;
|
lesionNumberCounter = measurement.lesionNumber;
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
lesionNumberCounter++;
|
lesionNumberCounter++;
|
||||||
}
|
});
|
||||||
|
|
||||||
return lesionNumberCounter;
|
return lesionNumberCounter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -43,7 +43,7 @@ Template.confirmDeleteDialog.events({
|
|||||||
|
|
||||||
closeHandler();
|
closeHandler();
|
||||||
},
|
},
|
||||||
'keypress #confirmDeleteDialog': function(e) {
|
'keydown #confirmDeleteDialog': function(e) {
|
||||||
if (e.which === keys.ESC) {
|
if (e.which === keys.ESC) {
|
||||||
closeHandler();
|
closeHandler();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -246,7 +246,7 @@ Template.lesionLocationDialog.events({
|
|||||||
var dialog = Template.lesionLocationDialog.dialog;
|
var dialog = Template.lesionLocationDialog.dialog;
|
||||||
closeHandler(dialog);
|
closeHandler(dialog);
|
||||||
},
|
},
|
||||||
'keypress #lesionLocationDialog, keypress #lesionLocationRelabelDialog': function(e) {
|
'keydown #lesionLocationDialog, keydown #lesionLocationRelabelDialog': function(e) {
|
||||||
var dialog = Template.lesionLocationDialog.dialog;
|
var dialog = Template.lesionLocationDialog.dialog;
|
||||||
|
|
||||||
// If Enter is pressed, close the dialog
|
// If Enter is pressed, close the dialog
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<template name="lesionTableRow">
|
<template name="lesionTableRow">
|
||||||
<tr id="{{lesionNumber}}" class="lesionTableRow" data-measurementid="{{_id}}">
|
<tr id="{{lesionNumber}}" class="lesionTableRow" data-measurementid="{{_id}}">
|
||||||
<td class='lesionNumber'>{{lesionNumber}}</td>
|
<td class='lesionNumber'>{{lesionNumberAbsolute}}</td>
|
||||||
<td class='location' tabindex="0">{{location}}</td>
|
<td class='location' tabindex="0">{{location}}</td>
|
||||||
<td class='target'>{{#if isTarget}} Y {{else}} N {{/if}}</td>
|
<td class='target'>{{#if isTarget}} Y {{else}} N {{/if}}</td>
|
||||||
<!--Each time point as a column-->
|
<!--Each time point as a column-->
|
||||||
|
|||||||
@ -19,14 +19,11 @@ Template.lesionTableTimepointCell.helpers({
|
|||||||
var data = lesionData.timepoints[this.timepointID];
|
var data = lesionData.timepoints[this.timepointID];
|
||||||
|
|
||||||
if (lesionData.isTarget === true) {
|
if (lesionData.isTarget === true) {
|
||||||
// TODO = Add short axis data here
|
|
||||||
//return 'LD: ' + data.longestDiameter;
|
|
||||||
if (data.shortestDiameter) {
|
if (data.shortestDiameter) {
|
||||||
return data.longestDiameter + " x " + data.shortestDiameter;
|
return data.longestDiameter + " x " + data.shortestDiameter;
|
||||||
|
|
||||||
}
|
}
|
||||||
return data.longestDiameter;
|
|
||||||
|
|
||||||
|
return data.longestDiameter;
|
||||||
} else {
|
} else {
|
||||||
return data.response;
|
return data.response;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,7 +9,7 @@
|
|||||||
<select id="selectNonTargetLesionLocation">
|
<select id="selectNonTargetLesionLocation">
|
||||||
<option value="-1"></option>
|
<option value="-1"></option>
|
||||||
{{ #each lesionLocations}}
|
{{ #each lesionLocations}}
|
||||||
<option value='{{_id}}'>{{location}}</option>
|
<option value={{_id}}>{{location}}</option>
|
||||||
{{ /each}}
|
{{ /each}}
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
@ -19,9 +19,9 @@
|
|||||||
<option value="-1"></option>
|
<option value="-1"></option>
|
||||||
{{ #each locationResponses}}
|
{{ #each locationResponses}}
|
||||||
{{ #if code }}
|
{{ #if code }}
|
||||||
<option value='{{code}}'>{{code}} - {{text}}</option>
|
<option value={{code}}>{{code}} - {{text}}</option>
|
||||||
{{ else }}
|
{{ else }}
|
||||||
<option value={{text}}}>{{text}}</option>
|
<option value={{text}}>{{text}}</option>
|
||||||
{{ /if }}
|
{{ /if }}
|
||||||
{{ /each}}
|
{{ /each}}
|
||||||
</select>
|
</select>
|
||||||
|
|||||||
@ -308,7 +308,7 @@ Template.nonTargetLesionDialog.events({
|
|||||||
var dialog = Template.nonTargetLesionDialog.dialog;
|
var dialog = Template.nonTargetLesionDialog.dialog;
|
||||||
closeHandler(dialog);
|
closeHandler(dialog);
|
||||||
},
|
},
|
||||||
'keypress #lesionLocationDialog, keypress #lesionLocationRelabelDialog': function(e) {
|
'keydown #lesionLocationDialog, keydown #lesionLocationRelabelDialog': function(e) {
|
||||||
var dialog = Template.nonTargetLesionDialog.dialog;
|
var dialog = Template.nonTargetLesionDialog.dialog;
|
||||||
|
|
||||||
// If Enter is pressed, close the dialog
|
// If Enter is pressed, close the dialog
|
||||||
|
|||||||
@ -133,7 +133,7 @@ Template.nonTargetResponseDialog.events({
|
|||||||
var dialog = Template.nonTargetResponseDialog.dialog;
|
var dialog = Template.nonTargetResponseDialog.dialog;
|
||||||
closeHandler(dialog);
|
closeHandler(dialog);
|
||||||
},
|
},
|
||||||
'keypress #nonTargetResponseDialog': function(e) {
|
'keydown #nonTargetResponseDialog': function(e) {
|
||||||
var dialog = Template.nonTargetResponseDialog.dialog;
|
var dialog = Template.nonTargetResponseDialog.dialog;
|
||||||
|
|
||||||
// If Enter is pressed, close the dialog
|
// If Enter is pressed, close the dialog
|
||||||
|
|||||||
@ -41,7 +41,7 @@ activateLesion = function(measurementId, templateData) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Loop through the viewports and display each timepoint
|
// Loop through the viewports and display each timepoint
|
||||||
$(".imageViewerViewport").each(function(viewportIndex, element) {
|
$(".imageViewerViewport").not('.empty').each(function(viewportIndex, element) {
|
||||||
// Stop if we run out of timepoints before viewports
|
// Stop if we run out of timepoints before viewports
|
||||||
if (viewportIndex >= timepointsWithEntries.length) {
|
if (viewportIndex >= timepointsWithEntries.length) {
|
||||||
// Update the element anyway, to remove any other highlights that are present
|
// Update the element anyway, to remove any other highlights that are present
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user