Add grade statistics endpoints

This commit is contained in:
Mikołaj Pich 2019-02-14 20:55:23 +01:00
parent dafdaa7b94
commit 59eb0332d7
No known key found for this signature in database
GPG key ID: F62B26E36D4C4BAA

View file

@ -541,14 +541,59 @@ router.all("/Sprawdziany.mvc/Get", (req, res) => {
router.all("/Statystyki.mvc/GetOcenyCzastkowe", (req, res) => { router.all("/Statystyki.mvc/GetOcenyCzastkowe", (req, res) => {
res.json({ res.json({
"data": {}, "data": _.chain(require("../../data/opiekun/oceny-statystyki-czastkowe"))
.groupBy("subject")
.map((series, subject) => ({ subject, series }))
.value()
.map(item => {
return {
"Subject": item.subject,
"IsAverage": false,
"ClassSeries": {
"Average": null,
"IsEmpty": false,
"Items": item.series.map(item => {
return {
"Label": item.classAmount.toString(),
"Value": item.classAmount
};
})
},
"StudentSeries": {
"Average": null,
"IsEmpty": false,
"Items": item.series.map(item => {
return {
"Label": item.pupilAmount.toString(),
"Value": item.pupilAmount
};
})
}
};
}),
"success": true "success": true
}); });
}); });
router.all("/Statystyki.mvc/GetOcenyRoczne", (req, res) => { router.all("/Statystyki.mvc/GetOcenyRoczne", (req, res) => {
res.json({ res.json({
"data": {}, "data": _.chain(require("../../data/opiekun/oceny-statystyki-roczne"))
.groupBy("subject")
.map((series, subject) => ({ subject, series }))
.value()
.map(item => {
return {
"Subject": item.subject,
"IsEmpty": false,
"Items": item.series.map((item, i) => {
return {
"Label": item.amount.toString(),
"Description": i === 2 ? "Tu jesteś" : "",
"Value": item.amount
};
})
};
}),
"success": true "success": true
}); });
}); });