LT-413: Enable analytics on Lesion Tracker

This commit is contained in:
Leonardo Campos committed 2017-02-14 01:25:50 -02:00
1 parent 33f9b8672b
commit b99b986630
11 files changed
+45 -7

No files matched your search

@@ -6,9 +6,11 @@ import { measurementTools } from 'meteor/ohif:lesiontracker/both/configuration/m
let MeasurementCollections = {};
measurementTools.forEach(tool => {
MeasurementCollections[tool.id] = new Mongo.Collection(tool.id);
MeasurementCollections[tool.id]._debugName = tool.id;
});
const Timepoints = new Mongo.Collection('timepoints');
Timepoints._debugName = 'Timepoints';
Timepoints.find().observe({
remove() {
@@ -18,10 +20,12 @@ Timepoints.find().observe({
// Drop our collections for testing purposes
Meteor.startup(() => {
Timepoints.remove({});
measurementTools.forEach(tool => {
MeasurementCollections[tool.id].remove({});
});
if (Meteor.settings.dropCollections) {
Timepoints.remove({});
measurementTools.forEach(tool => {
MeasurementCollections[tool.id].remove({});
});
}
});
// TODO: Make storage use update instead of clearing the entire collection and
@@ -39,10 +39,15 @@ Meteor.publish('reviewers', function() {
// Temporary fix to drop all Collections on server restart
// http://stackoverflow.com/questions/23891631/meteor-how-can-i-drop-all-mongo-collections-and-clear-all-data-on-startup
Meteor.startup(function() {
if (!Meteor.settings.dropCollections) {
return;
}
for (var property in global) {
var object = global[property];
if (object instanceof Meteor.Collection) {
if (!(/^server|currentServer$/).test(object._name)) {
console.warn(`Dropping: ${object._debugName || object._name}`);
object.remove({});
}
}