Comparing version 0.5.0 to 0.6.0
@@ -43,9 +43,5 @@ // Generated by CoffeeScript 1.6.3 | ||
} | ||
if (query.start_date && query.end_date && query.start_date.length && query.end_date.length) { | ||
start_date = new Date(Date.UTC(parseInt(query.start_date))); | ||
end_date = new Date(Date.UTC(parseInt(query.end_date))); | ||
end_date.setUTCHours(23); | ||
end_date.setMinutes(59); | ||
end_date.setSeconds(59); | ||
console.log('end date:', end_date); | ||
if ((query.start_date != null) && (query.end_date != null)) { | ||
start_date = new Date(parseInt(query.start_date)); | ||
end_date = new Date(parseInt(query.end_date)); | ||
parsed['datetime'] = { | ||
@@ -57,13 +53,8 @@ $gte: start_date, | ||
delete query.end_date; | ||
} else if (query.start_date && query.start_date.length) { | ||
} else if (query.start_date != null) { | ||
parsed['datetime'] = { | ||
$gte: new Date(Date.UTC(parseInt(query.start_date))) | ||
$gte: new Date(parseInt(query.start_date)) | ||
}; | ||
delete query.start_date; | ||
} else if (query.end_date && query.end_date.length) { | ||
end_date = new Date(Date.UTC(parseInt(query.end_date))); | ||
end_date.setHours(23); | ||
end_date.setMinutes(59); | ||
end_date.setSeconds(59); | ||
console.log('end date:', end_date); | ||
} else if (query.end_date != null) { | ||
parsed['datetime'] = { | ||
@@ -75,8 +66,4 @@ $lte: new Date(parseInt(query.end_date)) | ||
keys = _.keys(mongoose.model('Medici_Transaction').schema.paths); | ||
console.log('keys:', keys); | ||
for (key in query) { | ||
val = query[key]; | ||
if (!val) { | ||
continue; | ||
} | ||
if (keys.indexOf(key) >= 0) { | ||
@@ -99,3 +86,2 @@ /*if key.substr(0, 1) is '_' | ||
parsed.book = this.name; | ||
console.log('parsed query to:', parsed); | ||
return parsed; | ||
@@ -108,3 +94,2 @@ }; | ||
query = this.parseQuery(query); | ||
console.log('balance query:', query); | ||
match = { | ||
@@ -124,3 +109,2 @@ $match: query | ||
}; | ||
console.log('query:', match, group); | ||
mongoose.model('Medici_Transaction').aggregate(match, group, function(err, result) { | ||
@@ -133,3 +117,3 @@ var total; | ||
total = result.credit - result.debit; | ||
total = Math.round(total * 100) / 100; | ||
console.log('got total:', total); | ||
return deferred.resolve(total); | ||
@@ -136,0 +120,0 @@ } |
{ | ||
"name": "medici", | ||
"version": "0.5.0", | ||
"version": "0.6.0", | ||
"description": "Simple double-entry accounting for Node + Mongoose", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
0
34646
10
495