mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-09-16 03:28:30 +08:00
fixed long tests erroring out
This commit is contained in:
parent
5cfa792eb2
commit
c6e8b69435
1 changed files with 34 additions and 21 deletions
|
@ -87,21 +87,28 @@ class ResultController {
|
|||
.json({ message: "Result data doesn't make sense" });
|
||||
}
|
||||
|
||||
result.keySpacingStats = {
|
||||
average:
|
||||
result.keySpacing.reduce(
|
||||
(previous, current) => (current += previous)
|
||||
) / result.keySpacing.length,
|
||||
sd: stdDev(result.keySpacing),
|
||||
};
|
||||
|
||||
result.keyDurationStats = {
|
||||
average:
|
||||
result.keyDuration.reduce(
|
||||
(previous, current) => (current += previous)
|
||||
) / result.keyDuration.length,
|
||||
sd: stdDev(result.keyDuration),
|
||||
};
|
||||
try {
|
||||
result.keySpacingStats = {
|
||||
average:
|
||||
result.keySpacing.reduce(
|
||||
(previous, current) => (current += previous)
|
||||
) / result.keySpacing.length,
|
||||
sd: stdDev(result.keySpacing),
|
||||
};
|
||||
} catch (e) {
|
||||
//
|
||||
}
|
||||
try {
|
||||
result.keyDurationStats = {
|
||||
average:
|
||||
result.keyDuration.reduce(
|
||||
(previous, current) => (current += previous)
|
||||
) / result.keyDuration.length,
|
||||
sd: stdDev(result.keyDuration),
|
||||
};
|
||||
} catch (e) {
|
||||
//
|
||||
}
|
||||
|
||||
const user = await UserDAO.getUser(uid);
|
||||
// result.name = user.name;
|
||||
|
@ -145,12 +152,18 @@ class ResultController {
|
|||
delete result.keySpacing;
|
||||
delete result.keyDuration;
|
||||
|
||||
result.keyDurationStats.average = roundTo2(
|
||||
result.keyDurationStats.average
|
||||
);
|
||||
result.keyDurationStats.sd = roundTo2(result.keyDurationStats.sd);
|
||||
result.keySpacingStats.average = roundTo2(result.keySpacingStats.average);
|
||||
result.keySpacingStats.sd = roundTo2(result.keySpacingStats.sd);
|
||||
try {
|
||||
result.keyDurationStats.average = roundTo2(
|
||||
result.keyDurationStats.average
|
||||
);
|
||||
result.keyDurationStats.sd = roundTo2(result.keyDurationStats.sd);
|
||||
result.keySpacingStats.average = roundTo2(
|
||||
result.keySpacingStats.average
|
||||
);
|
||||
result.keySpacingStats.sd = roundTo2(result.keySpacingStats.sd);
|
||||
} catch (e) {
|
||||
//
|
||||
}
|
||||
|
||||
const isPb = await UserDAO.checkIfPb(uid, result);
|
||||
const tagPbs = await UserDAO.checkIfTagPb(uid, result);
|
||||
|
|
Loading…
Add table
Reference in a new issue