I have remote web api data like this:
[
{
"courseName": "Matematik",
"contentsCount": 2,
"createdDate": "2019/10/20"
},
{
"courseName": "Matematik",
"contentsCount": 1,
"createdDate": "2019/10/16"
},
{
"courseName": "Matematik",
"contentsCount": 1,
"createdDate": "2019/10/17"
},
{
"courseName": "Matematik",
"contentsCount": 2,
"createdDate": "2019/10/22"
},
{
"courseName": "Matematik",
"contentsCount": 1,
"createdDate": "2019/08/21"
},
{
"courseName": "Türkçe",
"contentsCount": 1,
"createdDate": "2019/10/20"
},
{
"courseName": "Türkçe",
"contentsCount": 1,
"createdDate": "2019/10/18"
},
{
"courseName": "Türkçe",
"contentsCount": 1,
"createdDate": "2019/10/21"
},
{
"courseName": "Türkçe",
"contentsCount": 1,
"createdDate": "2019/08/22"
},
{
"courseName": "Türkçe",
"contentsCount": 1,
"createdDate": "2019/09/21"
},
{
"courseName": "Türkçe",
"contentsCount": 1,
"createdDate": "2019/09/22"
}
]
I want to group this data by createdDate
and sum with contentsCount
after getting data remotely.
I am getting data like this with Angular 8.
return this.repository.getData(`api/course/contents/report/${this.teacherId}`)
.pipe(
groupBy(x => x["createdDate"]),
)
.toPromise()
.catch(error => { throw 'Data Loading Error' });
So how can I do this in RxJS pipe.
Thanks.