numberStr is key only

This commit is contained in:
oleg 2015-10-04 19:57:53 +03:00
parent ee9d6f3fde
commit 5bd98c6719
2 changed files with 14 additions and 7 deletions

17
db.js
View File

@ -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');
}
}
]
});
};

View File

@ -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) {