From 5bd98c6719307d4efc0efc6db225e3a4324cfd7e Mon Sep 17 00:00:00 2001 From: oleg Date: Sun, 4 Oct 2015 19:57:53 +0300 Subject: [PATCH] numberStr is key only --- db.js | 17 +++++++++++++---- distributor.js | 4 +--- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/db.js b/db.js index a1922aa..aba0f8a 100644 --- a/db.js +++ b/db.js @@ -3,7 +3,8 @@ var Steppy = require('twostep').Steppy, _ = require('underscore'), nlevel = require('nlevel'), - path = require('path'); + path = require('path'), + utils = require('./lib/utils'); exports.init = function(dbPath, params, callback) { @@ -83,9 +84,17 @@ exports.init = function(dbPath, params, callback) { exports.logLines = new nlevel.DocsSection(buildLogsDb, 'logLines', { projections: [ - {key: {buildId: 1, numberStr: 1}, value: function(logLine) { - return _(logLine).pick('number', 'text'); - }} + { + key: { + buildId: 1, + numberStr: function(logLine) { + return utils.toNumberStr(logLine.number); + } + }, + value: function(logLine) { + return _(logLine).pick('number', 'text'); + } + } ] }); }; diff --git a/distributor.js b/distributor.js index eaf7bc2..554fd6f 100644 --- a/distributor.js +++ b/distributor.js @@ -9,8 +9,7 @@ var Steppy = require('twostep').Steppy, db = require('./db'), path = require('path'), fs = require('fs'), - logger = require('./lib/logger')('distributor'), - utils = require('./lib/utils'); + logger = require('./lib/logger')('distributor'); exports.init = function(app, callback) { @@ -143,7 +142,6 @@ exports.init = function(app, callback) { db.logLines.put({ id: logLineId, buildId: build.id, - numberStr: utils.toNumberStr(logLineNumber), number: logLineNumber, text: data }, function(err) {