You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 9, 2020. It is now read-only.
i'm working on a project that need capabilities that universe library have, but i had some trouble implementing the squash method.
This is my code, basically its the same with the example provided in the readme section
universe([{date: "2011-11-14T16:17:54Z",quantity: 2,total: 190,tip: 100,type: "tab",productIDs: ["001"]},{date: "2011-11-14T16:20:19Z",quantity: 2,total: 190,tip: 100,type: "tab",productIDs: ["001","005"]},{date: "2011-11-14T16:28:54Z",quantity: 1,total: 300,tip: 200,type: "visa",productIDs: ["004","005"]},{date: "2011-11-14T16:28:54Z",quantity: 3,total: 285,tip: 100,type: "tab",productIDs: ["001","002","005"]}]).then(function(myUniverse){myUniverse.query({groupBy: 'type',// GroupBy the type keyselect: {$count: true,// Count the number of recordsquantity: {// Create a custom 'quantity' column$sum: 'quantity'// Sum the quantity column},},// Limit selection to rows where quantity is greater than 50filter: {tip: {$gt: 50}},}).then(function(result){result.squash(null,null,{count: '$sum',quantity: {sum: '$sum'}},'Total').then(function(resultq){console.log(JSON.stringify(resultq.data));})})
I will leave this open in the event that someone wants to try to fix the problem and send a pull request, or that @tannerlinsley has time to take a look at it.
After a couple of try and error, i believe this bug is because of a set method in the file lodash.js. I have able to fix this bug, and i've made the pull request #44
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
i'm working on a project that need capabilities that universe library have, but i had some trouble implementing the squash method.
This is my code, basically its the same with the example provided in the readme section
universe_squash.txt
and this is the output
[{"key":"Total","value":{"count":4,"quantity":{"0":"sum"}}}]
what i was expecting from what i read in the example is something like the output below
[{"key":"Total","value":{"count":4,"quantity":{"sum":8}}}]
Am i calling the squash method the wrong way or is this a bug?
Sorry for my bad English.
The text was updated successfully, but these errors were encountered: