added c# backend
This commit is contained in:
@@ -28,40 +28,6 @@ router.get("/gettopten", async (req, res) => {
|
||||
console.log(err);
|
||||
res.status(400).json({ message: "Error" });
|
||||
}
|
||||
// how much time each user has logged during that time period
|
||||
// let items = {};
|
||||
// let itemIdtoName = {};
|
||||
// for (let i = 0; i < results.length; i++) {
|
||||
// if (results[i][filterBy] in items) {
|
||||
// items[results[i][filterBy]] += results[i].time;
|
||||
// } else {
|
||||
// items[results[i][filterBy]] = results[i].time;
|
||||
// if (filterBy === "user")
|
||||
// itemIdtoName[results[i][filterBy]] =
|
||||
// results[i].f_name + " " + results[i].l_name;
|
||||
// else itemIdtoName[results[i][filterBy]] = results[i].name;
|
||||
// }
|
||||
// }
|
||||
// let respData = {};
|
||||
// for (let key in items) {
|
||||
// if (items.hasOwnProperty(key)) {
|
||||
// respData[itemIdtoName[key]] = items[key];
|
||||
// }
|
||||
// }
|
||||
// // transform obj to array
|
||||
// respData = Object.keys(items).map(function (key) {
|
||||
// return [key, items[key]];
|
||||
// });
|
||||
//
|
||||
// // sort the array based on the second element
|
||||
// respData.sort(function (first, second) {
|
||||
// return second[1] - first[1];
|
||||
// });
|
||||
//
|
||||
// // console.log(itemIdtoName);
|
||||
// // console.log(respData);
|
||||
// // Create a new array with only the first 10 items
|
||||
// respData = respData.slice(0, 10);
|
||||
|
||||
res.json(results);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user