2017-05-26 11:17:32 -07:00
|
|
|
Meteor.methods({
|
2025-07-02 11:18:09 -07:00
|
|
|
"checkDuplicateSales": async function() {
|
2017-05-26 11:17:32 -07:00
|
|
|
try {
|
2025-07-02 11:18:09 -07:00
|
|
|
let sales = await Sales.find({}).fetchAsync();
|
2017-05-26 11:17:32 -07:00
|
|
|
let duplicateCount = 0;
|
|
|
|
|
|
|
|
|
|
for(let i = 0; i < sales.length; i++) {
|
|
|
|
|
let next = missingData[i];
|
2025-07-02 11:18:09 -07:00
|
|
|
let count = await Sales.countDocuments({date: next.date, measureId: next.measureId, productId: next.productId, venueId: next.venueId, price: next.price, amount: next.amount});
|
2017-05-26 11:17:32 -07:00
|
|
|
|
|
|
|
|
if(count > 1) {
|
|
|
|
|
console.log("This sale has a duplicate:");
|
|
|
|
|
console.log(next);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
console.log("Total Duplicate Count: " + duplicateCount);
|
|
|
|
|
console.log("Finished Checking Duplicates");
|
|
|
|
|
Meteor.log.info("xxx");
|
|
|
|
|
} catch(err) {
|
|
|
|
|
console.log(err);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|