Need to group array of objects and sum by property
- or -
Post a project like this2771
€50(approx. $54)
- Posted:
- Proposals: 3
- Remote
- #1272445
- Awarded
Description
Experience Level: Expert
General information for the business: Financial
Description of requirements/functionality: Lodash groupby and/or reduce help
Specific technologies required: javascript, lodash library
Extra notes: I'm building my own app (nearly finished) using Laravel/Jquery/AJAX and I'm stuck at one issue that I cannot solve.
My app deals with mortgages. I have several mortgages running in parallel, and I just need to sum-up total payments per period.
Let's say that we have the following arrays of objects (i.e. mortgages):
[ {uptomonth:84 , payment:150} ]
[ {uptomonth:120 , payment:200} ]
[ {uptomonth:120 , payment:100} , {uptomonth:180 , payment:250} , {uptomonth:300 , payment:500} ]
How to read this (example for 1st line): "up to month number 84, I pay $150 per month".
I'm using Lodash.js library.
1st I combine all these as objects into one array using _.flatten().
Then I need to sort them by "uptomonth": I tried _.orderby and _.sortby... but it does not work... I need help on that.
Finally I need to obtain a result array like that:
[ {uptomonth:84,payment:1200} , {uptomonth:120,payment:1050} , {uptomonth:180,payment:750} , {uptomonth:300,payment:500} ]
The most difficult for me is to group by "uptomonth" (since there are duplicates of this value), and get the total payments per "uptomonth"... but taking into account also the other mortgages running at the same time!
I tried with methods reduce and groupby... but I cannot figure out how to do that.
What I need is the following:
2 hours Skype session with a Javascript/Lodash expert who will help me to find the solution. I will also help since I have some knowledge of all that.
I will also prepare a drawing...
Skype session between 8:00 am and 8:00pm GMT+1 time (Paris).
Please don't send proposal for full software development service.
I only need 2 hours help from an expert, and I will be done.
Thanks a lot.
Description of requirements/functionality: Lodash groupby and/or reduce help
Specific technologies required: javascript, lodash library
Extra notes: I'm building my own app (nearly finished) using Laravel/Jquery/AJAX and I'm stuck at one issue that I cannot solve.
My app deals with mortgages. I have several mortgages running in parallel, and I just need to sum-up total payments per period.
Let's say that we have the following arrays of objects (i.e. mortgages):
[ {uptomonth:84 , payment:150} ]
[ {uptomonth:120 , payment:200} ]
[ {uptomonth:120 , payment:100} , {uptomonth:180 , payment:250} , {uptomonth:300 , payment:500} ]
How to read this (example for 1st line): "up to month number 84, I pay $150 per month".
I'm using Lodash.js library.
1st I combine all these as objects into one array using _.flatten().
Then I need to sort them by "uptomonth": I tried _.orderby and _.sortby... but it does not work... I need help on that.
Finally I need to obtain a result array like that:
[ {uptomonth:84,payment:1200} , {uptomonth:120,payment:1050} , {uptomonth:180,payment:750} , {uptomonth:300,payment:500} ]
The most difficult for me is to group by "uptomonth" (since there are duplicates of this value), and get the total payments per "uptomonth"... but taking into account also the other mortgages running at the same time!
I tried with methods reduce and groupby... but I cannot figure out how to do that.
What I need is the following:
2 hours Skype session with a Javascript/Lodash expert who will help me to find the solution. I will also help since I have some knowledge of all that.
I will also prepare a drawing...
Skype session between 8:00 am and 8:00pm GMT+1 time (Paris).
Please don't send proposal for full software development service.
I only need 2 hours help from an expert, and I will be done.
Thanks a lot.
Nadir B.
100% (2)Projects Completed
2
Freelancers worked with
2
Projects awarded
33%
Last project
14 Sep 2016
France
New Proposal
Login to your account and send a proposal now to get this project.
Log inClarification Board Ask a Question
-
There are no clarification messages.
We collect cookies to enable the proper functioning and security of our website, and to enhance your experience. By clicking on 'Accept All Cookies', you consent to the use of these cookies. You can change your 'Cookies Settings' at any time. For more information, please read ourCookie Policy
Cookie Settings
Accept All Cookies