mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2024-11-10 01:02:30 +01:00
Remove unnecessary call in userInfo
This commit is contained in:
parent
2fc31655ff
commit
4e93a007c2
1 changed files with 7 additions and 3 deletions
|
@ -205,14 +205,18 @@ async function getUserInfo(req: Request, res: Response): Promise<Response> {
|
||||||
return res.status(400).send("Invalid userID or publicUserID parameter");
|
return res.status(400).send("Invalid userID or publicUserID parameter");
|
||||||
}
|
}
|
||||||
|
|
||||||
const segmentsSummary = await dbGetSubmittedSegmentSummary(hashedUserID);
|
|
||||||
const responseObj = {} as Record<string, string|SegmentUUID|number>;
|
const responseObj = {} as Record<string, string|SegmentUUID|number>;
|
||||||
for (const property of paramValues) {
|
for (const property of paramValues) {
|
||||||
responseObj[property] = await dbGetValue(hashedUserID, property);
|
responseObj[property] = await dbGetValue(hashedUserID, property);
|
||||||
}
|
}
|
||||||
|
|
||||||
// add minutesSaved and segmentCount after to avoid getting overwritten
|
// add minutesSaved and segmentCount after to avoid getting overwritten
|
||||||
if (paramValues.includes("minutesSaved")) responseObj["minutesSaved"] = segmentsSummary.minutesSaved;
|
if (paramValues.includes("minutesSaved") || paramValues.includes("segmentCount")) {
|
||||||
if (paramValues.includes("segmentCount")) responseObj["segmentCount"] = segmentsSummary.segmentCount;
|
const segmentsSummary = await dbGetSubmittedSegmentSummary(hashedUserID);
|
||||||
|
responseObj["minutesSaved"] = segmentsSummary.minutesSaved;
|
||||||
|
responseObj["segmentCount"] = segmentsSummary.segmentCount;
|
||||||
|
}
|
||||||
|
|
||||||
return res.send(responseObj);
|
return res.send(responseObj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue