From 521507e425de96537c439b1f9d931bcd4beb1abc Mon Sep 17 00:00:00 2001 From: vjrj Date: Mon, 29 Jan 2018 20:21:01 +0100 Subject: [PATCH] Confidence value check --- imports/api/Fires/server/publications.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/imports/api/Fires/server/publications.js b/imports/api/Fires/server/publications.js index a7c0c43..be2be60 100644 --- a/imports/api/Fires/server/publications.js +++ b/imports/api/Fires/server/publications.js @@ -36,6 +36,14 @@ Meteor.publish('fireFromHash', function fireFromHash(fireEnc) { const u = unsealed.updatedAt; unsealed.updatedAt = !u ? new Date() : new Date(u); // console.log(unsealed); + + // FIXME: + if (typeof unsealed.confidence === 'string') { + unsealed.confidence = Number.parseInt(unsealed.confidence, 10); + } + if (typeof unsealed.confidence === 'undefined' || isNaN(unsealed.confidence)) { + delete unsealed.confidence; + } FiresCollection.schema.validate(unsealed); const fire = findFire(unsealed); // console.log(`Found: ${fire.count()}`);