general cleanup

This commit is contained in:
zkldi
2021-04-27 00:44:26 +01:00
parent e8426ec99b
commit 709a996d98
8 changed files with 33 additions and 35 deletions
+2 -7
View File
@@ -1,6 +1,4 @@
import {
ChartDocument,
config,
CounterDocument,
FolderDocument,
Game,
@@ -8,11 +6,9 @@ import {
IIDXBPIData,
IIDXEamusementScoreDocument,
ImportDocument,
SongDocument,
InviteCodeDocument,
MilestoneDocument,
NotificationDocument,
Playtypes,
PrivateUserDocument,
PublicAPIKeyDocument,
ScoreDocument,
@@ -22,9 +18,8 @@ import {
UserGoalDocument,
UserMilestoneDocument,
} from "kamaitachi-common";
import monk, { ICollection } from "monk";
import monk from "monk";
import CreateLogCtx from "../logger";
import { TextDocument } from "../types";
const logger = CreateLogCtx("db.ts");
@@ -44,7 +39,7 @@ monkDB
.then(() => {
if (process.env.NODE_ENV !== "test") {
let time = process.hrtime(dbtime);
let elapsed = time[0] + time[1] / 1000000;
let elapsed = time[0] + time[1] / 1e6;
logger.info(`Database connection successful: took ${elapsed}ms`);
}
})
@@ -34,21 +34,6 @@ export class KTDataNotFoundFailure<T extends keyof typeof Converters> extends Co
}
}
/**
* ScoreExistsError - A score with this ID already exists.
* Since this error is mostly useless to the end user (people re-import scores all the time!)
* This is not returned from score processing, however, it exists so the reason for the error can be
* sussed out.
*/
export class ScoreExistsFailure extends ConverterFailure {
scoreID: string;
constructor(message: string | null, scoreID: string) {
super(message);
this.scoreID = scoreID;
}
}
/**
* InvalidScoreError - This score provided invalid data that Kamaitachi can not accept.
*/
@@ -249,7 +249,7 @@ export async function LoadScoresIntoSessions(
}
);
} else {
logger.verbose(
logger.debug(
`Creating new session for ${userID} (${game} ${playtype}) around ${startOfGroup} ${endOfGroup}.`
);
@@ -52,7 +52,7 @@ export async function ImportAllIterableData<D, C>(
let nonFlatDatapoints = await Promise.all(promises);
logger.verbose(`Finished Importing Data (${promises.length} datapoints).`);
logger.verbose(`Flattening returns...`);
logger.debug(`Flattening returns...`);
let flatDatapoints = [];
@@ -74,7 +74,7 @@ export async function ImportAllIterableData<D, C>(
}
}
logger.verbose(`Flattened returns.`);
logger.debug(`Flattened returns.`);
logger.verbose(`Recieved ${flatDatapoints.length} returns, from ${promises.length} data.`);
@@ -180,7 +180,7 @@ async function ImportFromConverterReturn(
return null;
}
logger.verbose(`Successfully imported score: ${result.scoreID}`);
logger.debug(`Successfully imported score: ${result.scoreID}`);
return {
success: true,
@@ -166,7 +166,7 @@ async function EamScoreConverter(
}
dryScore.scoreData.hitMeta.bp = numBP;
} else if (eamScore.bp === "---") {
logger.verbose(
logger.debug(
`Skipped assigning BP for score as it had expected null value of ${eamScore.bp}.`
);
} else {
@@ -1,5 +0,0 @@
[{
"text": "adjective1"
}, {
"text": "adjective2"
}]
-3
View File
@@ -1,3 +0,0 @@
[{
"text": "noun1"
}]
@@ -0,0 +1,26 @@
[
{
"userID": 1,
"importType": "file/csv:eamusement-iidx",
"name": "adjective1 adjective2 noun1",
"sessionID": "Qe7b00261b1d3ba8e5c9ee4e76e77ea9f07d9493b",
"desc": null,
"game": "iidx",
"playtype": "SP",
"highlight": false,
"scoreInfo": [
{
"scoreID": "TESTING_SCORE_ID",
"isNewScore": true
}
],
"timeInserted": 1619454485988,
"timeStarted": 1608346320000,
"timeEnded": 1608369300000,
"calculatedData": {
"scorePerf": 0,
"lampPerf": 0,
"perf": 0
}
}
]