diff --git a/.env.example b/.env.example index 38ffb5e..a4db6cf 100644 --- a/.env.example +++ b/.env.example @@ -7,6 +7,8 @@ JWT_SECRET=wow POSTGRES_DB=chromacase API_URL=http://localhost:80/api SCORO_URL=ws://localhost:6543 +MINIO_ROOT_PASSWORD=12345678 + GOOGLE_CLIENT_ID=toto GOOGLE_SECRET=tata GOOGLE_CALLBACK_URL=http://localhost:19006/logged/google diff --git a/.gitignore b/.gitignore index 642004d..0863c88 100644 --- a/.gitignore +++ b/.gitignore @@ -13,5 +13,6 @@ log.html node_modules/ ./front/coverage .venv +.data .DS_Store _gen diff --git a/back/Dockerfile b/back/Dockerfile index 65bba41..0ad3d61 100644 --- a/back/Dockerfile +++ b/back/Dockerfile @@ -5,4 +5,4 @@ RUN npm install --frozen-lockfile COPY . . RUN npx prisma generate RUN npm run build -CMD npx prisma migrate dev; npm run start:prod +CMD npx prisma migrate deploy; npm run start:prod diff --git a/back/package-lock.json b/back/package-lock.json index 342e2cd..cf1eb24 100644 --- a/back/package-lock.json +++ b/back/package-lock.json @@ -25,6 +25,7 @@ "bcryptjs": "^2.4.3", "class-transformer": "^0.5.1", "class-validator": "^0.14.0", + "json-logger-service": "^9.0.1", "node-fetch": "^2.6.12", "nodemailer": "^6.9.5", "passport-google-oauth20": "^2.0.0", @@ -3887,6 +3888,34 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/bunyan": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/bunyan/-/bunyan-2.0.5.tgz", + "integrity": "sha512-Jvl74TdxCN6rSP9W1I6+UOUtwslTDqsSFkDqZlFb/ilaSvQ+bZAnXT/GT97IZ5L+Vph0joPZPhxUyn6FLNmFAA==", + "engines": [ + "node >=0.10.0" + ], + "dependencies": { + "exeunt": "1.1.0" + }, + "bin": { + "bunyan": "bin/bunyan" + }, + "optionalDependencies": { + "dtrace-provider": "~0.8", + "moment": "^2.19.3", + "mv": "~2", + "safe-json-stringify": "~1" + } + }, + "node_modules/bunyan-prettystream": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/bunyan-prettystream/-/bunyan-prettystream-0.1.3.tgz", + "integrity": "sha512-ovZoJY65kWByTUEDu1gMB89t+NGV9Ixm7azEhp2zXiGfSTvPGlu8+HFiVp6XuEQw0P6OS0oyi/Za6gknsl8Bwg==", + "engines": [ + "node >=0.8.0" + ] + }, "node_modules/busboy": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/busboy/-/busboy-1.6.0.tgz", @@ -5294,6 +5323,19 @@ "node": ">=12" } }, + "node_modules/dtrace-provider": { + "version": "0.8.8", + "resolved": "https://registry.npmjs.org/dtrace-provider/-/dtrace-provider-0.8.8.tgz", + "integrity": "sha512-b7Z7cNtHPhH9EJhNNbbeqTcXB8LGFFZhq1PGgEvpeHlzd36bhbdTWoE/Ba/YguqpBSlAPKnARWhVlhunCMwfxg==", + "hasInstallScript": true, + "optional": true, + "dependencies": { + "nan": "^2.14.0" + }, + "engines": { + "node": ">=0.10" + } + }, "node_modules/eastasianwidth": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", @@ -5892,6 +5934,14 @@ "url": "https://github.com/sindresorhus/execa?sponsor=1" } }, + "node_modules/exeunt": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/exeunt/-/exeunt-1.1.0.tgz", + "integrity": "sha512-dd++Yn/0Fp+gtJ04YHov7MeAii+LFivJc6KqnJNfplzLVUkUDrfKoQDTLlCgzcW15vY5hKlHasWeIsQJ8agHsw==", + "engines": { + "node": ">=0.10" + } + }, "node_modules/exit": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz", @@ -8239,6 +8289,115 @@ "node": ">=4" } }, + "node_modules/json-logger-service": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/json-logger-service/-/json-logger-service-9.0.1.tgz", + "integrity": "sha512-/dHqGBGZzkO7w0QtWCibHDU9J55v1RuJ4Y2CH6mnCLPs8XfFL4qTUS1Ui68NiI6bI9Wbb5C1Qxhco937iusKKw==", + "dependencies": { + "@nestjs/common": "^9.0.0", + "@nestjs/core": "^9.0.0", + "@nestjs/platform-express": "^9.0.0", + "bunyan": "^2.0.0", + "bunyan-prettystream": "^0.1.3", + "on-finished": "^2.3.0", + "reflect-metadata": "^0.1.13", + "rxjs": "^7.1.0" + } + }, + "node_modules/json-logger-service/node_modules/@nestjs/common": { + "version": "9.4.3", + "resolved": "https://registry.npmjs.org/@nestjs/common/-/common-9.4.3.tgz", + "integrity": "sha512-Gd6D4IaYj01o14Bwv81ukidn4w3bPHCblMUq+SmUmWLyosK+XQmInCS09SbDDZyL8jy86PngtBLTdhJ2bXSUig==", + "dependencies": { + "iterare": "1.2.1", + "tslib": "2.5.3", + "uid": "2.0.2" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/nest" + }, + "peerDependencies": { + "cache-manager": "<=5", + "class-transformer": "*", + "class-validator": "*", + "reflect-metadata": "^0.1.12", + "rxjs": "^7.1.0" + }, + "peerDependenciesMeta": { + "cache-manager": { + "optional": true + }, + "class-transformer": { + "optional": true + }, + "class-validator": { + "optional": true + } + } + }, + "node_modules/json-logger-service/node_modules/@nestjs/core": { + "version": "9.4.3", + "resolved": "https://registry.npmjs.org/@nestjs/core/-/core-9.4.3.tgz", + "integrity": "sha512-Qi63+wi55Jh4sDyaj5Hhx2jOpKqT386aeo+VOKsxnd+Ql9VvkO/FjmuwBGUyzkJt29ENYc+P0Sx/k5LtstNpPQ==", + "hasInstallScript": true, + "dependencies": { + "@nuxtjs/opencollective": "0.3.2", + "fast-safe-stringify": "2.1.1", + "iterare": "1.2.1", + "path-to-regexp": "3.2.0", + "tslib": "2.5.3", + "uid": "2.0.2" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/nest" + }, + "peerDependencies": { + "@nestjs/common": "^9.0.0", + "@nestjs/microservices": "^9.0.0", + "@nestjs/platform-express": "^9.0.0", + "@nestjs/websockets": "^9.0.0", + "reflect-metadata": "^0.1.12", + "rxjs": "^7.1.0" + }, + "peerDependenciesMeta": { + "@nestjs/microservices": { + "optional": true + }, + "@nestjs/platform-express": { + "optional": true + }, + "@nestjs/websockets": { + "optional": true + } + } + }, + "node_modules/json-logger-service/node_modules/@nestjs/platform-express": { + "version": "9.4.3", + "resolved": "https://registry.npmjs.org/@nestjs/platform-express/-/platform-express-9.4.3.tgz", + "integrity": "sha512-FpdczWoRSC0zz2dNL9u2AQLXKXRVtq4HgHklAhbL59X0uy+mcxhlSThG7DHzDMkoSnuuHY8ojDVf7mDxk+GtCw==", + "dependencies": { + "body-parser": "1.20.2", + "cors": "2.8.5", + "express": "4.18.2", + "multer": "1.4.4-lts.1", + "tslib": "2.5.3" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/nest" + }, + "peerDependencies": { + "@nestjs/common": "^9.0.0", + "@nestjs/core": "^9.0.0" + } + }, + "node_modules/json-logger-service/node_modules/tslib": { + "version": "2.5.3", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.5.3.tgz", + "integrity": "sha512-mSxlJJwl3BMEQCUNnxXBU9jP4JBktcEGhURcPR6VQVlnP0FdDEsIaz0C35dXNGLyRfrATNofF0F5p2KPxQgB+w==" + }, "node_modules/json-parse-even-better-errors": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", @@ -9291,6 +9450,15 @@ "mkdirp": "bin/cmd.js" } }, + "node_modules/moment": { + "version": "2.29.4", + "resolved": "https://registry.npmjs.org/moment/-/moment-2.29.4.tgz", + "integrity": "sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w==", + "optional": true, + "engines": { + "node": "*" + } + }, "node_modules/ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", @@ -9319,6 +9487,54 @@ "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==", "dev": true }, + "node_modules/mv": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/mv/-/mv-2.1.1.tgz", + "integrity": "sha512-at/ZndSy3xEGJ8i0ygALh8ru9qy7gWW1cmkaqBN29JmMlIvM//MEO9y1sk/avxuwnPcfhkejkLsuPxH81BrkSg==", + "optional": true, + "dependencies": { + "mkdirp": "~0.5.1", + "ncp": "~2.0.0", + "rimraf": "~2.4.0" + }, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/mv/node_modules/glob": { + "version": "6.0.4", + "resolved": "https://registry.npmjs.org/glob/-/glob-6.0.4.tgz", + "integrity": "sha512-MKZeRNyYZAVVVG1oZeLaWie1uweH40m9AZwIwxyPbTSX4hHrVYSzLg0Ro5Z5R7XKkIX+Cc6oD1rqeDJnwsB8/A==", + "optional": true, + "dependencies": { + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "2 || 3", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + } + }, + "node_modules/mv/node_modules/rimraf": { + "version": "2.4.5", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.4.5.tgz", + "integrity": "sha512-J5xnxTyqaiw06JjMftq7L9ouA448dw/E7dKghkP9WpKNuwmARNNg+Gk8/u5ryb9N/Yo2+z3MCwuqFK/+qPOPfQ==", + "optional": true, + "dependencies": { + "glob": "^6.0.1" + }, + "bin": { + "rimraf": "bin.js" + } + }, + "node_modules/nan": { + "version": "2.18.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.18.0.tgz", + "integrity": "sha512-W7tfG7vMOGtD30sHoZSSc/JVYiyDPEyQVso/Zz+/uQd0B0L46gtC+pHha5FFMRpil6fm/AoEcRWyOVi4+E/f8w==", + "optional": true + }, "node_modules/natural-compare": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", @@ -9331,6 +9547,15 @@ "integrity": "sha512-Tj+HTDSJJKaZnfiuw+iaF9skdPpTo2GtEly5JHnWV/hfv2Qj/9RKsGISQtLh2ox3l5EAGw487hnBee0sIJ6v2g==", "dev": true }, + "node_modules/ncp": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ncp/-/ncp-2.0.0.tgz", + "integrity": "sha512-zIdGUrPRFTUELUvr3Gmc7KZ2Sw/h1PiVM0Af/oHB6zgnV1ikqSfRk+TOufi79aHYCW3NiOXmr1BP5nWbzojLaA==", + "optional": true, + "bin": { + "ncp": "bin/ncp" + } + }, "node_modules/negotiator": { "version": "0.6.3", "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", @@ -11202,6 +11427,12 @@ } ] }, + "node_modules/safe-json-stringify": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/safe-json-stringify/-/safe-json-stringify-1.2.0.tgz", + "integrity": "sha512-gH8eh2nZudPQO6TytOvbxnuhYBOvDBBLW52tz5q6X58lJcd/tkmqFR+5Z9adS8aJtURSXWThWy/xJtJwixErvg==", + "optional": true + }, "node_modules/safer-buffer": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", @@ -16057,6 +16288,23 @@ "run-applescript": "^5.0.0" } }, + "bunyan": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/bunyan/-/bunyan-2.0.5.tgz", + "integrity": "sha512-Jvl74TdxCN6rSP9W1I6+UOUtwslTDqsSFkDqZlFb/ilaSvQ+bZAnXT/GT97IZ5L+Vph0joPZPhxUyn6FLNmFAA==", + "requires": { + "dtrace-provider": "~0.8", + "exeunt": "1.1.0", + "moment": "^2.19.3", + "mv": "~2", + "safe-json-stringify": "~1" + } + }, + "bunyan-prettystream": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/bunyan-prettystream/-/bunyan-prettystream-0.1.3.tgz", + "integrity": "sha512-ovZoJY65kWByTUEDu1gMB89t+NGV9Ixm7azEhp2zXiGfSTvPGlu8+HFiVp6XuEQw0P6OS0oyi/Za6gknsl8Bwg==" + }, "busboy": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/busboy/-/busboy-1.6.0.tgz", @@ -17111,6 +17359,15 @@ "resolved": "https://registry.npmjs.org/dotenv-expand/-/dotenv-expand-10.0.0.tgz", "integrity": "sha512-GopVGCpVS1UKH75VKHGuQFqS1Gusej0z4FyQkPdwjil2gNIv+LNsqBlboOzpJFZKVT95GkCyWJbBSdFEFUWI2A==" }, + "dtrace-provider": { + "version": "0.8.8", + "resolved": "https://registry.npmjs.org/dtrace-provider/-/dtrace-provider-0.8.8.tgz", + "integrity": "sha512-b7Z7cNtHPhH9EJhNNbbeqTcXB8LGFFZhq1PGgEvpeHlzd36bhbdTWoE/Ba/YguqpBSlAPKnARWhVlhunCMwfxg==", + "optional": true, + "requires": { + "nan": "^2.14.0" + } + }, "eastasianwidth": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", @@ -17531,6 +17788,11 @@ "strip-final-newline": "^2.0.0" } }, + "exeunt": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/exeunt/-/exeunt-1.1.0.tgz", + "integrity": "sha512-dd++Yn/0Fp+gtJ04YHov7MeAii+LFivJc6KqnJNfplzLVUkUDrfKoQDTLlCgzcW15vY5hKlHasWeIsQJ8agHsw==" + }, "exit": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz", @@ -19313,6 +19575,63 @@ "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==", "dev": true }, + "json-logger-service": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/json-logger-service/-/json-logger-service-9.0.1.tgz", + "integrity": "sha512-/dHqGBGZzkO7w0QtWCibHDU9J55v1RuJ4Y2CH6mnCLPs8XfFL4qTUS1Ui68NiI6bI9Wbb5C1Qxhco937iusKKw==", + "requires": { + "@nestjs/common": "^9.0.0", + "@nestjs/core": "^9.0.0", + "@nestjs/platform-express": "^9.0.0", + "bunyan": "^2.0.0", + "bunyan-prettystream": "^0.1.3", + "on-finished": "^2.3.0", + "reflect-metadata": "^0.1.13", + "rxjs": "^7.1.0" + }, + "dependencies": { + "@nestjs/common": { + "version": "9.4.3", + "resolved": "https://registry.npmjs.org/@nestjs/common/-/common-9.4.3.tgz", + "integrity": "sha512-Gd6D4IaYj01o14Bwv81ukidn4w3bPHCblMUq+SmUmWLyosK+XQmInCS09SbDDZyL8jy86PngtBLTdhJ2bXSUig==", + "requires": { + "iterare": "1.2.1", + "tslib": "2.5.3", + "uid": "2.0.2" + } + }, + "@nestjs/core": { + "version": "9.4.3", + "resolved": "https://registry.npmjs.org/@nestjs/core/-/core-9.4.3.tgz", + "integrity": "sha512-Qi63+wi55Jh4sDyaj5Hhx2jOpKqT386aeo+VOKsxnd+Ql9VvkO/FjmuwBGUyzkJt29ENYc+P0Sx/k5LtstNpPQ==", + "requires": { + "@nuxtjs/opencollective": "0.3.2", + "fast-safe-stringify": "2.1.1", + "iterare": "1.2.1", + "path-to-regexp": "3.2.0", + "tslib": "2.5.3", + "uid": "2.0.2" + } + }, + "@nestjs/platform-express": { + "version": "9.4.3", + "resolved": "https://registry.npmjs.org/@nestjs/platform-express/-/platform-express-9.4.3.tgz", + "integrity": "sha512-FpdczWoRSC0zz2dNL9u2AQLXKXRVtq4HgHklAhbL59X0uy+mcxhlSThG7DHzDMkoSnuuHY8ojDVf7mDxk+GtCw==", + "requires": { + "body-parser": "1.20.2", + "cors": "2.8.5", + "express": "4.18.2", + "multer": "1.4.4-lts.1", + "tslib": "2.5.3" + } + }, + "tslib": { + "version": "2.5.3", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.5.3.tgz", + "integrity": "sha512-mSxlJJwl3BMEQCUNnxXBU9jP4JBktcEGhURcPR6VQVlnP0FdDEsIaz0C35dXNGLyRfrATNofF0F5p2KPxQgB+w==" + } + } + }, "json-parse-even-better-errors": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", @@ -20231,6 +20550,12 @@ "minimist": "^1.2.6" } }, + "moment": { + "version": "2.29.4", + "resolved": "https://registry.npmjs.org/moment/-/moment-2.29.4.tgz", + "integrity": "sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w==", + "optional": true + }, "ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", @@ -20256,6 +20581,47 @@ "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==", "dev": true }, + "mv": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/mv/-/mv-2.1.1.tgz", + "integrity": "sha512-at/ZndSy3xEGJ8i0ygALh8ru9qy7gWW1cmkaqBN29JmMlIvM//MEO9y1sk/avxuwnPcfhkejkLsuPxH81BrkSg==", + "optional": true, + "requires": { + "mkdirp": "~0.5.1", + "ncp": "~2.0.0", + "rimraf": "~2.4.0" + }, + "dependencies": { + "glob": { + "version": "6.0.4", + "resolved": "https://registry.npmjs.org/glob/-/glob-6.0.4.tgz", + "integrity": "sha512-MKZeRNyYZAVVVG1oZeLaWie1uweH40m9AZwIwxyPbTSX4hHrVYSzLg0Ro5Z5R7XKkIX+Cc6oD1rqeDJnwsB8/A==", + "optional": true, + "requires": { + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "2 || 3", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "rimraf": { + "version": "2.4.5", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.4.5.tgz", + "integrity": "sha512-J5xnxTyqaiw06JjMftq7L9ouA448dw/E7dKghkP9WpKNuwmARNNg+Gk8/u5ryb9N/Yo2+z3MCwuqFK/+qPOPfQ==", + "optional": true, + "requires": { + "glob": "^6.0.1" + } + } + } + }, + "nan": { + "version": "2.18.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.18.0.tgz", + "integrity": "sha512-W7tfG7vMOGtD30sHoZSSc/JVYiyDPEyQVso/Zz+/uQd0B0L46gtC+pHha5FFMRpil6fm/AoEcRWyOVi4+E/f8w==", + "optional": true + }, "natural-compare": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", @@ -20268,6 +20634,12 @@ "integrity": "sha512-Tj+HTDSJJKaZnfiuw+iaF9skdPpTo2GtEly5JHnWV/hfv2Qj/9RKsGISQtLh2ox3l5EAGw487hnBee0sIJ6v2g==", "dev": true }, + "ncp": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ncp/-/ncp-2.0.0.tgz", + "integrity": "sha512-zIdGUrPRFTUELUvr3Gmc7KZ2Sw/h1PiVM0Af/oHB6zgnV1ikqSfRk+TOufi79aHYCW3NiOXmr1BP5nWbzojLaA==", + "optional": true + }, "negotiator": { "version": "0.6.3", "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", @@ -21638,6 +22010,12 @@ "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==" }, + "safe-json-stringify": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/safe-json-stringify/-/safe-json-stringify-1.2.0.tgz", + "integrity": "sha512-gH8eh2nZudPQO6TytOvbxnuhYBOvDBBLW52tz5q6X58lJcd/tkmqFR+5Z9adS8aJtURSXWThWy/xJtJwixErvg==", + "optional": true + }, "safer-buffer": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", diff --git a/back/package.json b/back/package.json index 465d396..86f0414 100644 --- a/back/package.json +++ b/back/package.json @@ -36,6 +36,8 @@ "@types/passport": "^1.0.12", "bcryptjs": "^2.4.3", "class-transformer": "^0.5.1", + "class-validator": "^0.13.2", + "json-logger-service": "^9.0.1", "class-validator": "^0.14.0", "node-fetch": "^2.6.12", "nodemailer": "^6.9.5", diff --git a/back/src/history/dto/SearchHistoryDto.ts b/back/src/history/dto/SearchHistoryDto.ts index 3ecbba6..1d2fb75 100644 --- a/back/src/history/dto/SearchHistoryDto.ts +++ b/back/src/history/dto/SearchHistoryDto.ts @@ -1,9 +1,9 @@ -import { ApiProperty } from "@nestjs/swagger"; +import { ApiProperty } from '@nestjs/swagger'; export class SearchHistoryDto { @ApiProperty() query: string; @ApiProperty() - type: "song" | "artist" | "album" | "genre"; + type: 'song' | 'artist' | 'album' | 'genre'; } diff --git a/back/src/history/dto/SongHistoryDto.ts b/back/src/history/dto/SongHistoryDto.ts index ff9ec68..b180a12 100644 --- a/back/src/history/dto/SongHistoryDto.ts +++ b/back/src/history/dto/SongHistoryDto.ts @@ -1,5 +1,5 @@ -import { ApiProperty } from "@nestjs/swagger"; -import { IsNumber } from "class-validator"; +import { ApiProperty } from '@nestjs/swagger'; +import { IsNumber } from 'class-validator'; export class SongHistoryDto { @ApiProperty() @@ -15,8 +15,8 @@ export class SongHistoryDto { score: number; @ApiProperty() - difficulties: Record + difficulties: Record; @ApiProperty() - info: Record + info: Record; } diff --git a/back/src/history/history.controller.ts b/back/src/history/history.controller.ts index 72a1b2f..1d4db7d 100644 --- a/back/src/history/history.controller.ts +++ b/back/src/history/history.controller.ts @@ -22,7 +22,7 @@ import { SearchHistory as _SearchHistory} from 'src/_gen/prisma-class/search_his @Controller('history') @ApiTags('history') export class HistoryController { - constructor(private readonly historyService: HistoryService) { } + constructor(private readonly historyService: HistoryService) {} @Get() @HttpCode(200) @@ -60,15 +60,18 @@ export class HistoryController { return this.historyService.createSongHistoryRecord(record); } - @Post("search") + @Post('search') @HttpCode(201) @ApiOperation({ description: "Creates a search record in the users history"}) @UseGuards(JwtAuthGuard) - @ApiUnauthorizedResponse({description: "Invalid token"}) + @ApiUnauthorizedResponse({ description: 'Invalid token' }) async createSearchHistory( @Request() req: any, - @Body() record: SearchHistoryDto - ): Promise { - await this.historyService.createSearchHistoryRecord(req.user.id, { query: record.query, type: record.type }); - } + @Body() record: SearchHistoryDto, + ): Promise { + await this.historyService.createSearchHistoryRecord(req.user.id, { + query: record.query, + type: record.type, + }); + } } diff --git a/back/src/history/history.service.spec.ts b/back/src/history/history.service.spec.ts index b79a1c6..8a1f463 100644 --- a/back/src/history/history.service.spec.ts +++ b/back/src/history/history.service.spec.ts @@ -2,17 +2,17 @@ import { Test, TestingModule } from '@nestjs/testing'; import { HistoryService } from './history.service'; describe('HistoryService', () => { - let service: HistoryService; + let service: HistoryService; - beforeEach(async () => { - const module: TestingModule = await Test.createTestingModule({ - providers: [HistoryService], - }).compile(); + beforeEach(async () => { + const module: TestingModule = await Test.createTestingModule({ + providers: [HistoryService], + }).compile(); - service = module.get(HistoryService); - }); + service = module.get(HistoryService); + }); - it('should be defined', () => { - expect(service).toBeDefined(); - }); + it('should be defined', () => { + expect(service).toBeDefined(); + }); }); diff --git a/back/src/history/history.service.ts b/back/src/history/history.service.ts index 8d89435..fff3518 100644 --- a/back/src/history/history.service.ts +++ b/back/src/history/history.service.ts @@ -6,7 +6,7 @@ import { SongHistoryDto } from './dto/SongHistoryDto'; @Injectable() export class HistoryService { - constructor(private prisma: PrismaService) { } + constructor(private prisma: PrismaService) {} async createSongHistoryRecord({ songID, @@ -74,7 +74,7 @@ export class HistoryService { async createSearchHistoryRecord( userID: number, - { query, type }: SearchHistoryDto + { query, type }: SearchHistoryDto, ): Promise { return this.prisma.searchHistory.create({ data: { diff --git a/back/src/main.ts b/back/src/main.ts index 1ed8573..d52f4a6 100644 --- a/back/src/main.ts +++ b/back/src/main.ts @@ -1,12 +1,57 @@ import { NestFactory } from '@nestjs/core'; import { AppModule } from './app.module'; import { SwaggerModule, DocumentBuilder } from '@nestjs/swagger'; -import { ValidationPipe } from '@nestjs/common'; +import { + CallHandler, + ExecutionContext, + Injectable, + NestInterceptor, + ValidationPipe, +} from '@nestjs/common'; +import { RequestLogger, RequestLoggerOptions } from 'json-logger-service'; +import { tap } from 'rxjs'; import { PrismaModel } from './_gen/prisma-class' +import { PrismaService } from './prisma/prisma.service'; +@Injectable() +export class AspectLogger implements NestInterceptor { + intercept(context: ExecutionContext, next: CallHandler) { + const req = context.switchToHttp().getRequest(); + const res = context.switchToHttp().getResponse(); + const { statusCode } = context.switchToHttp().getResponse(); + const { originalUrl, method, params, query, body, user } = req; + + const toPrint = { + originalUrl, + method, + params, + query, + body, + userId: user?.id ?? 'not logged in', + username: user?.username ?? 'not logged in', + }; + + return next.handle().pipe( + tap((data) => + console.log( + JSON.stringify({ + ...toPrint, + statusCode, + data, + }), + ), + ), + ); + } +} async function bootstrap() { const app = await NestFactory.create(AppModule); + app.use( + RequestLogger.buildExpressRequestLogger({ + doNotLogPaths: ['/health'], + } as RequestLoggerOptions), + ); app.enableShutdownHooks(); const config = new DocumentBuilder() @@ -19,6 +64,8 @@ async function bootstrap() { app.useGlobalPipes(new ValidationPipe()); app.enableCors(); + app.useGlobalInterceptors(new AspectLogger()); + await app.listen(3000); } bootstrap(); diff --git a/back/src/search/search.controller.ts b/back/src/search/search.controller.ts index c0012dc..9c54632 100644 --- a/back/src/search/search.controller.ts +++ b/back/src/search/search.controller.ts @@ -24,14 +24,17 @@ import { Artist as _Artist } from 'src/_gen/prisma-class/artist'; @ApiTags('search') @Controller('search') export class SearchController { - constructor(private readonly searchService: SearchService) { } + constructor(private readonly searchService: SearchService) {} @Get('songs/:query') @ApiOkResponse({ type: _Song, isArray: true}) @ApiOperation({ description: "Search a song"}) @ApiUnauthorizedResponse({ description: "Invalid token"}) @UseGuards(JwtAuthGuard) - async searchSong(@Request() req: any, @Param('query') query: string): Promise { + async searchSong( + @Request() req: any, + @Param('query') query: string, + ): Promise { try { const ret = await this.searchService.songByGuess(query, req.user?.id); if (!ret.length) throw new NotFoundException(); @@ -70,4 +73,4 @@ export class SearchController { throw new InternalServerErrorException(); } } -} \ No newline at end of file +} diff --git a/back/src/search/search.service.ts b/back/src/search/search.service.ts index 77d6fce..fd0ad5d 100644 --- a/back/src/search/search.service.ts +++ b/back/src/search/search.service.ts @@ -5,7 +5,10 @@ import { PrismaService } from 'src/prisma/prisma.service'; @Injectable() export class SearchService { - constructor(private prisma: PrismaService, private history: HistoryService) { } + constructor( + private prisma: PrismaService, + private history: HistoryService, + ) {} async songByGuess(query: string, userID: number): Promise { return this.prisma.song.findMany({ diff --git a/back/src/settings/settings.module.ts b/back/src/settings/settings.module.ts index bd3000f..54dd693 100644 --- a/back/src/settings/settings.module.ts +++ b/back/src/settings/settings.module.ts @@ -3,8 +3,8 @@ import { SettingsService } from './settings.service'; import { PrismaModule } from 'src/prisma/prisma.module'; @Module({ - imports: [PrismaModule], - providers: [SettingsService], - exports: [SettingsService], + imports: [PrismaModule], + providers: [SettingsService], + exports: [SettingsService], }) export class SettingsModule {} diff --git a/back/src/settings/settings.service.ts b/back/src/settings/settings.service.ts index cda9072..cf00f74 100644 --- a/back/src/settings/settings.service.ts +++ b/back/src/settings/settings.service.ts @@ -20,10 +20,10 @@ export class SettingsService { user: { connect: { id: userId, - } - } - } - }) + }, + }, + }, + }); } async updateUserSettings(params: { @@ -37,7 +37,9 @@ export class SettingsService { }); } - async deleteUserSettings(where: Prisma.UserSettingsWhereUniqueInput): Promise { + async deleteUserSettings( + where: Prisma.UserSettingsWhereUniqueInput, + ): Promise { return this.prisma.userSettings.delete({ where, }); diff --git a/config/logs_nginx.conf b/config/logs_nginx.conf new file mode 100644 index 0000000..38472b1 --- /dev/null +++ b/config/logs_nginx.conf @@ -0,0 +1,37 @@ +user nginx; +worker_processes 5; ## Default: 1 +events { + worker_connections 1000; +} +http { + resolver 127.0.0.11; + server { + listen 3100; + location = / { + return 200 'OK'; + auth_basic off; + } + location = /api/prom/push { + proxy_pass http://write:3100\$$request_uri; + } + location = /api/prom/tail { + proxy_pass http://read:3100\$$request_uri; + proxy_set_header Upgrade \$$http_upgrade; + proxy_set_header Connection "upgrade"; + } + location ~ /api/prom/.* { + proxy_pass http://read:3100\$$request_uri; + } + location = /loki/api/v1/push { + proxy_pass http://write:3100\$$request_uri; + } + location = /loki/api/v1/tail { + proxy_pass http://read:3100\$$request_uri; + proxy_set_header Upgrade \$$http_upgrade; + proxy_set_header Connection "upgrade"; + } + location ~ /loki/api/.* { + proxy_pass http://read:3100\$$request_uri; + } + } +} \ No newline at end of file diff --git a/config/loki-config.yaml b/config/loki-config.yaml new file mode 100644 index 0000000..d87373f --- /dev/null +++ b/config/loki-config.yaml @@ -0,0 +1,36 @@ +--- +auth_enabled: false +server: + http_listen_port: 3100 +memberlist: + join_members: + - loki:7946 +schema_config: + configs: + - from: 2021-08-01 + store: boltdb-shipper + object_store: s3 + schema: v11 + index: + prefix: index_ + period: 24h +common: + path_prefix: /loki + replication_factor: 1 + storage: + s3: + endpoint: minio:9000 + insecure: true + bucketnames: loki-data + access_key_id: loki + secret_access_key: 12345678 + s3forcepathstyle: true + ring: + kvstore: + store: memberlist +query_range: + parallelise_shardable_queries: false +ruler: + storage: + s3: + bucketnames: loki-ruler diff --git a/config/promtail-local-config.yaml b/config/promtail-local-config.yaml new file mode 100644 index 0000000..dcb2d3e --- /dev/null +++ b/config/promtail-local-config.yaml @@ -0,0 +1,22 @@ +--- +server: + http_listen_port: 9080 + grpc_listen_port: 0 + +positions: + filename: /tmp/positions.yaml + +clients: + - url: http://gateway:3100/loki/api/v1/push + tenant_id: tenant1 + +scrape_configs: + - job_name: flog_scrape + docker_sd_configs: + - host: unix:///var/run/docker.sock + refresh_interval: 5s + relabel_configs: + - source_labels: ['__meta_docker_container_name'] + regex: '/(.*)' + target_label: 'container' + diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index 57c2455..100eb77 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -1,3 +1,10 @@ +networks: + loki: + +volumes: + scoro_logs: + + services: back: build: @@ -25,6 +32,9 @@ services: volumes: - ./scorometer:/app - ./assets:/assets + - scoro_logs:/logs + networks: + - loki db: container_name: db diff --git a/docker-compose.log.yml b/docker-compose.log.yml new file mode 100644 index 0000000..380e3ee --- /dev/null +++ b/docker-compose.log.yml @@ -0,0 +1,185 @@ +services: + read: + image: grafana/loki:2.8.2 + command: "-config.file=/etc/loki/config.yaml -target=read" + ports: + - 3101:3100 + - 7946 + - 9095 + volumes: + - ./config/loki-config.yaml:/etc/loki/config.yaml + depends_on: + - minio + healthcheck: + test: [ "CMD-SHELL", "wget --no-verbose --tries=1 --spider http://localhost:3100/ready || exit 1" ] + interval: 10s + timeout: 5s + retries: 5 + networks: &loki-dns + loki: + aliases: + - loki + + write: + image: grafana/loki:2.8.2 + command: "-config.file=/etc/loki/config.yaml -target=write" + ports: + - 3102:3100 + - 7946 + - 9095 + volumes: + - ./config/loki-config.yaml:/etc/loki/config.yaml + healthcheck: + test: [ "CMD-SHELL", "wget --no-verbose --tries=1 --spider http://localhost:3100/ready || exit 1" ] + interval: 10s + timeout: 5s + retries: 5 + depends_on: + - minio + networks: + <<: *loki-dns + + promtail: + image: grafana/promtail:2.8.2 + volumes: + - ./config/promtail-local-config.yaml:/etc/promtail/config.yaml:ro + - /var/run/docker.sock:/var/run/docker.sock + command: -config.file=/etc/promtail/config.yaml + depends_on: + - gateway + networks: + - loki + + minio: + image: minio/minio:RELEASE.2023-07-21T21-12-44Z + entrypoint: + - sh + - -euc + - | + mkdir -p /data/loki-data && \ + mkdir -p /data/loki-ruler && \ + minio server /data + environment: + - MINIO_ROOT_USER=loki + - MINIO_ROOT_PASSWORD=${MINIO_ROOT_PASSWORD} + - MINIO_PROMETHEUS_AUTH_TYPE=public + - MINIO_UPDATE=off + ports: + - 9000 + volumes: + - ./.data/minio:/data + healthcheck: + test: [ "CMD", "curl", "-f", "http://localhost:9000/minio/health/live" ] + interval: 15s + timeout: 20s + retries: 5 + networks: + - loki + + grafana: + image: grafana/grafana:9.5.6 + environment: + - GF_PATHS_PROVISIONING=/etc/grafana/provisioning + - GF_AUTH_ANONYMOUS_ENABLED=true + - GF_AUTH_ANONYMOUS_ORG_ROLE=Admin + depends_on: + - gateway + entrypoint: + - sh + - -euc + - | + mkdir -p /etc/grafana/provisioning/datasources + cat < /etc/grafana/provisioning/datasources/ds.yaml + apiVersion: 1 + datasources: + - name: Loki + type: loki + access: proxy + url: http://gateway:3100 + jsonData: + httpHeaderName1: "X-Scope-OrgID" + secureJsonData: + httpHeaderValue1: "tenant1" + EOF + /run.sh + ports: + - "3001:3000" + volumes: + - ./grafana/dashboard.yaml:/etc/grafana/provisioning/dashboards/main.yaml + - ./grafana/dashboards:/var/lib/grafana/dashboards + healthcheck: + test: [ "CMD-SHELL", "wget --no-verbose --tries=1 --spider http://localhost:3001/api/health || exit 1" ] + interval: 10s + timeout: 5s + retries: 5 + networks: + - loki + + gateway: + image: nginx:1.25.1 + depends_on: + - read + - write + entrypoint: + - sh + - -euc + - | + cat < /etc/nginx/nginx.conf + user nginx; + worker_processes 5; ## Default: 1 + + events { + worker_connections 1000; + } + + http { + resolver 127.0.0.11; + + server { + listen 3100; + + location = / { + return 200 'OK'; + auth_basic off; + } + + location = /api/prom/push { + proxy_pass http://write:3100\$$request_uri; + } + + location = /api/prom/tail { + proxy_pass http://read:3100\$$request_uri; + proxy_set_header Upgrade \$$http_upgrade; + proxy_set_header Connection "upgrade"; + } + + location ~ /api/prom/.* { + proxy_pass http://read:3100\$$request_uri; + } + + location = /loki/api/v1/push { + proxy_pass http://write:3100\$$request_uri; + } + + location = /loki/api/v1/tail { + proxy_pass http://read:3100\$$request_uri; + proxy_set_header Upgrade \$$http_upgrade; + proxy_set_header Connection "upgrade"; + } + + location ~ /loki/api/.* { + proxy_pass http://read:3100\$$request_uri; + } + } + } + EOF + /docker-entrypoint.sh nginx -g "daemon off;" + ports: + - "3100:3100" + healthcheck: + test: ["CMD", "service", "nginx", "status"] + interval: 10s + timeout: 5s + retries: 5 + networks: + - loki diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index ed94396..df20693 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -1,3 +1,9 @@ +networks: + loki: + +volumes: + scoro_logs: + services: back: image: ghcr.io/chroma-case/back:main @@ -16,13 +22,14 @@ services: ports: - "6543:6543" volumes: + - scoro_logs:/logs - ./assets:/assets db: container_name: db image: postgres:alpine3.14 environment: - POSTGRES_USER=${POSTGRES_USER} - - POSTGRES_PASSWORD=${POSTGRES_PASSWORD} + - POSTGRES_PASSWORD=${POSTGRES_PASSWORDgrafana} - POSTGRES_DB=${POSTGRES_DB} ports: - "5432:5432" @@ -43,4 +50,4 @@ services: depends_on: - "back" env_file: - - .env + - .env \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index eb054e8..0b227df 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,3 +1,12 @@ +networks: + loki: + + +volumes: + db: + scoro_logs: + + services: back: build: ./back @@ -17,6 +26,7 @@ services: - "6543:6543" volumes: - ./assets:/assets + - scoro_logs:/logs db: container_name: db image: postgres:alpine3.14 @@ -45,7 +55,4 @@ services: depends_on: - "back" env_file: - - .env - -volumes: - db: + - .env \ No newline at end of file diff --git a/grafana/dashboard.yaml b/grafana/dashboard.yaml new file mode 100644 index 0000000..57d3797 --- /dev/null +++ b/grafana/dashboard.yaml @@ -0,0 +1,12 @@ +apiVersion: 1 + +providers: + - name: "Dashboard provider" + orgId: 1 + type: file + disableDeletion: false + updateIntervalSeconds: 10 + allowUiUpdates: false + options: + path: /var/lib/grafana/dashboards + foldersFromFilesStructure: true \ No newline at end of file diff --git a/grafana/dashboards/grafana_dashboard.json b/grafana/dashboards/grafana_dashboard.json new file mode 100644 index 0000000..208a79f --- /dev/null +++ b/grafana/dashboards/grafana_dashboard.json @@ -0,0 +1,283 @@ +{ + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": { + "type": "grafana", + "uid": "-- Grafana --" + }, + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations & Alerts", + "type": "dashboard" + } + ] + }, + "editable": true, + "fiscalYearStartMonth": 0, + "graphTooltip": 0, + "id": 1, + "links": [], + "liveNow": false, + "panels": [ + { + "datasource": { + "type": "loki", + "uid": "P8E80F9AEF21F6940" + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 0 + }, + "id": 1, + "options": { + "dedupStrategy": "none", + "enableLogDetails": true, + "prettifyLogMessage": false, + "showCommonLabels": false, + "showLabels": false, + "showTime": false, + "sortOrder": "Descending", + "wrapLogMessage": false + }, + "targets": [ + { + "datasource": { + "type": "loki", + "uid": "P8E80F9AEF21F6940" + }, + "editorMode": "builder", + "expr": "{container=\"chromacase-back-1\"} | json | userId = `$userId`", + "key": "Q-a2f514d0-81a4-4c43-a260-bad7add20957-1", + "queryType": "range", + "refId": "B" + } + ], + "title": "Back logs by user id", + "type": "logs" + }, + { + "datasource": { + "type": "loki", + "uid": "P8E80F9AEF21F6940" + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 0 + }, + "id": 2, + "options": { + "dedupStrategy": "none", + "enableLogDetails": true, + "prettifyLogMessage": false, + "showCommonLabels": false, + "showLabels": false, + "showTime": false, + "sortOrder": "Descending", + "wrapLogMessage": false + }, + "targets": [ + { + "datasource": { + "type": "loki", + "uid": "P8E80F9AEF21F6940" + }, + "editorMode": "builder", + "expr": "{container=\"chromacase-back-1\"} | json | username = `$username`", + "key": "Q-a2f514d0-81a4-4c43-a260-bad7add20957-1", + "queryType": "range", + "refId": "B" + } + ], + "title": "Back logs by username", + "type": "logs" + }, + { + "datasource": { + "type": "loki", + "uid": "P8E80F9AEF21F6940" + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 8 + }, + "id": 4, + "options": { + "dedupStrategy": "none", + "enableLogDetails": true, + "prettifyLogMessage": false, + "showCommonLabels": false, + "showLabels": false, + "showTime": false, + "sortOrder": "Ascending", + "wrapLogMessage": false + }, + "targets": [ + { + "datasource": { + "type": "loki", + "uid": "P8E80F9AEF21F6940" + }, + "editorMode": "code", + "expr": "{container=\"chromacase-back-1\"}", + "key": "Q-a2f514d0-81a4-4c43-a260-bad7add20957-1", + "queryType": "range", + "refId": "B" + } + ], + "title": "Back logs", + "type": "logs" + }, + { + "datasource": { + "type": "loki", + "uid": "P8E80F9AEF21F6940" + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 8 + }, + "id": 3, + "options": { + "dedupStrategy": "none", + "enableLogDetails": true, + "prettifyLogMessage": false, + "showCommonLabels": false, + "showLabels": false, + "showTime": false, + "sortOrder": "Descending", + "wrapLogMessage": false + }, + "targets": [ + { + "datasource": { + "type": "loki", + "uid": "P8E80F9AEF21F6940" + }, + "editorMode": "code", + "expr": "{container=\"chromacase-front-1\"} | json", + "key": "Q-a2f514d0-81a4-4c43-a260-bad7add20957-1", + "queryType": "range", + "refId": "B" + } + ], + "title": "Front logs", + "type": "logs" + }, + { + "datasource": { + "type": "loki", + "uid": "P8E80F9AEF21F6940" + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 16 + }, + "id": 5, + "options": { + "dedupStrategy": "none", + "enableLogDetails": true, + "prettifyLogMessage": false, + "showCommonLabels": false, + "showLabels": false, + "showTime": false, + "sortOrder": "Descending", + "wrapLogMessage": false + }, + "targets": [ + { + "datasource": { + "type": "loki", + "uid": "P8E80F9AEF21F6940" + }, + "editorMode": "code", + "expr": "{container=\"chromacase-scorometer-1\"}", + "key": "Q-a2f514d0-81a4-4c43-a260-bad7add20957-1", + "queryType": "range", + "refId": "B" + } + ], + "title": "Scorometer logs", + "type": "logs" + } + ], + "refresh": "", + "schemaVersion": 38, + "style": "dark", + "tags": [], + "templating": { + "list": [ + { + "current": { + "selected": false, + "text": "2", + "value": "2" + }, + "hide": 0, + "name": "userId", + "options": [ + { + "selected": true, + "text": "2", + "value": "2" + } + ], + "query": "2", + "skipUrlSync": false, + "type": "textbox" + }, + { + "current": { + "selected": false, + "text": "lou", + "value": "lou" + }, + "hide": 0, + "name": "username", + "options": [ + { + "selected": true, + "text": "lou", + "value": "lou" + } + ], + "query": "lou", + "skipUrlSync": false, + "type": "textbox" + }, + { + "current": {}, + "description": "unique id of scorometer game", + "hide": 0, + "label": "game uuid", + "name": "game_uuid", + "options": [], + "query": "", + "skipUrlSync": false, + "type": "textbox" + } + ] + }, + "time": { + "from": "now-6h", + "to": "now" + }, + "timepicker": {}, + "timezone": "", + "title": "Chromacase dashboard", + "uid": "c3d1eb51-85f6-43d3-b2fd-e0096b72cf67", + "version": 2, + "weekStart": "" + } \ No newline at end of file diff --git a/scorometer/main.py b/scorometer/main.py index adbb7f6..52e0a08 100755 --- a/scorometer/main.py +++ b/scorometer/main.py @@ -6,7 +6,9 @@ import operator import os import sys from typing import TypedDict - +from pathlib import Path +import logging_loki +from multiprocessing import Queue import requests from chroma_case.Key import Key from chroma_case.Message import ( @@ -21,10 +23,32 @@ from chroma_case.Message import ( from chroma_case.Partition import Partition from chroma_case.song_check import getPartition from mido import MidiFile +import uuid +game_uuid = uuid.uuid4() -logging.basicConfig(stream=sys.stderr, level=logging.DEBUG) +testing = os.environ.get("SCORO_TEST") +if not testing: + + logname = f"/logs/{game_uuid}.log" + Path("/logs").mkdir(parents=True, exist_ok=True) + Path(logname).touch(exist_ok=True) + logging.basicConfig(filename=logname, + filemode='a', level=logging.DEBUG) + +''' +Logging to loki directly + +handler = logging_loki.LokiHandler( + url="http://gateway:3100/loki/api/v1/push", + tags={"application": "scorometer"}, + version="1", +) + +logger = logging.getLogger() +logger.addHandler(handler) +''' BACK_URL = os.environ.get("BACK_URL") or "http://back:3000" MUSICS_FOLDER = os.environ.get("MUSICS_FOLDER") or "/assets/musics/" @@ -80,6 +104,7 @@ class Scorometer: def send(self, obj): obj["info"] = self.info + obj["game_id"] = str(game_uuid) if not testing else "test" send(obj) def getPracticePartition(self, mode: int) -> list[list[Key]]: @@ -287,7 +312,7 @@ class Scorometer: def gameLoop(self): while True: message, line = getMessage() - logging.debug(f"handling message {line}") + logging.debug(f"handling message {line}", extra={"tags": {"service": "my-service"}}) self.handleMessage(message, line) def endGame(self): diff --git a/scorometer/requirements.txt b/scorometer/requirements.txt index 9e1e42e..d294b79 100644 --- a/scorometer/requirements.txt +++ b/scorometer/requirements.txt @@ -2,3 +2,4 @@ mido requests black-with-tabs validated-dc +python-logging-loki \ No newline at end of file diff --git a/scorometer/tests/almost_perfect_play/output b/scorometer/tests/almost_perfect_play/output index 85c81f4..68578fb 100644 --- a/scorometer/tests/almost_perfect_play/output +++ b/scorometer/tests/almost_perfect_play/output @@ -1,19 +1,19 @@ -{"type": "timing", "id": 2, "timing": "perfect", "info": {"max_score": 1000, "score": 100, "wrong": 0, "missed": 0, "perfect": 1, "great": 0, "good": 0, "current_streak": 1, "max_streak": 1}} -{"type": "duration", "id": 2, "duration": "perfect", "info": {"max_score": 1000, "score": 100, "wrong": 0, "missed": 0, "perfect": 1, "great": 0, "good": 0, "current_streak": 1, "max_streak": 1}} -{"type": "timing", "id": 3, "timing": "perfect", "info": {"max_score": 1000, "score": 200, "wrong": 0, "missed": 0, "perfect": 2, "great": 0, "good": 0, "current_streak": 2, "max_streak": 2}} -{"type": "duration", "id": 3, "duration": "perfect", "info": {"max_score": 1000, "score": 200, "wrong": 0, "missed": 0, "perfect": 2, "great": 0, "good": 0, "current_streak": 2, "max_streak": 2}} -{"type": "timing", "id": 4, "timing": "perfect", "info": {"max_score": 1000, "score": 300, "wrong": 0, "missed": 0, "perfect": 3, "great": 0, "good": 0, "current_streak": 3, "max_streak": 3}} -{"type": "duration", "id": 4, "duration": "perfect", "info": {"max_score": 1000, "score": 300, "wrong": 0, "missed": 0, "perfect": 3, "great": 0, "good": 0, "current_streak": 3, "max_streak": 3}} -{"type": "timing", "id": 5, "timing": "perfect", "info": {"max_score": 1000, "score": 400, "wrong": 0, "missed": 0, "perfect": 4, "great": 0, "good": 0, "current_streak": 4, "max_streak": 4}} -{"type": "duration", "id": 5, "duration": "perfect", "info": {"max_score": 1000, "score": 400, "wrong": 0, "missed": 0, "perfect": 4, "great": 0, "good": 0, "current_streak": 4, "max_streak": 4}} -{"type": "timing", "id": 6, "timing": "perfect", "info": {"max_score": 1000, "score": 500, "wrong": 0, "missed": 0, "perfect": 5, "great": 0, "good": 0, "current_streak": 5, "max_streak": 5}} -{"type": "duration", "id": 6, "duration": "perfect", "info": {"max_score": 1000, "score": 500, "wrong": 0, "missed": 0, "perfect": 5, "great": 0, "good": 0, "current_streak": 5, "max_streak": 5}} -{"type": "timing", "id": 7, "timing": "perfect", "info": {"max_score": 1000, "score": 600, "wrong": 0, "missed": 0, "perfect": 6, "great": 0, "good": 0, "current_streak": 6, "max_streak": 6}} -{"type": "duration", "id": 7, "duration": "perfect", "info": {"max_score": 1000, "score": 600, "wrong": 0, "missed": 0, "perfect": 6, "great": 0, "good": 0, "current_streak": 6, "max_streak": 6}} -{"type": "timing", "id": 8, "timing": "perfect", "info": {"max_score": 1000, "score": 700, "wrong": 0, "missed": 0, "perfect": 7, "great": 0, "good": 0, "current_streak": 7, "max_streak": 7}} -{"type": "duration", "id": 8, "duration": "perfect", "info": {"max_score": 1000, "score": 700, "wrong": 0, "missed": 0, "perfect": 7, "great": 0, "good": 0, "current_streak": 7, "max_streak": 7}} -{"type": "timing", "id": 9, "timing": "perfect", "info": {"max_score": 1000, "score": 800, "wrong": 0, "missed": 0, "perfect": 8, "great": 0, "good": 0, "current_streak": 8, "max_streak": 8}} -{"type": "duration", "id": 9, "duration": "perfect", "info": {"max_score": 1000, "score": 800, "wrong": 0, "missed": 0, "perfect": 8, "great": 0, "good": 0, "current_streak": 8, "max_streak": 8}} -{"type": "timing", "id": 10, "timing": "perfect", "info": {"max_score": 1000, "score": 900, "wrong": 0, "missed": 0, "perfect": 9, "great": 0, "good": 0, "current_streak": 9, "max_streak": 9}} -{"type": "duration", "id": 10, "duration": "perfect", "info": {"max_score": 1000, "score": 900, "wrong": 0, "missed": 0, "perfect": 9, "great": 0, "good": 0, "current_streak": 9, "max_streak": 9}} +{"type": "timing", "id": 2, "timing": "perfect", "info": {"max_score": 1000, "score": 100, "wrong": 0, "missed": 0, "perfect": 1, "great": 0, "good": 0, "current_streak": 1, "max_streak": 1}, "game_id": "test"} +{"type": "duration", "id": 2, "duration": "perfect", "info": {"max_score": 1000, "score": 100, "wrong": 0, "missed": 0, "perfect": 1, "great": 0, "good": 0, "current_streak": 1, "max_streak": 1}, "game_id": "test"} +{"type": "timing", "id": 3, "timing": "perfect", "info": {"max_score": 1000, "score": 200, "wrong": 0, "missed": 0, "perfect": 2, "great": 0, "good": 0, "current_streak": 2, "max_streak": 2}, "game_id": "test"} +{"type": "duration", "id": 3, "duration": "perfect", "info": {"max_score": 1000, "score": 200, "wrong": 0, "missed": 0, "perfect": 2, "great": 0, "good": 0, "current_streak": 2, "max_streak": 2}, "game_id": "test"} +{"type": "timing", "id": 4, "timing": "perfect", "info": {"max_score": 1000, "score": 300, "wrong": 0, "missed": 0, "perfect": 3, "great": 0, "good": 0, "current_streak": 3, "max_streak": 3}, "game_id": "test"} +{"type": "duration", "id": 4, "duration": "perfect", "info": {"max_score": 1000, "score": 300, "wrong": 0, "missed": 0, "perfect": 3, "great": 0, "good": 0, "current_streak": 3, "max_streak": 3}, "game_id": "test"} +{"type": "timing", "id": 5, "timing": "perfect", "info": {"max_score": 1000, "score": 400, "wrong": 0, "missed": 0, "perfect": 4, "great": 0, "good": 0, "current_streak": 4, "max_streak": 4}, "game_id": "test"} +{"type": "duration", "id": 5, "duration": "perfect", "info": {"max_score": 1000, "score": 400, "wrong": 0, "missed": 0, "perfect": 4, "great": 0, "good": 0, "current_streak": 4, "max_streak": 4}, "game_id": "test"} +{"type": "timing", "id": 6, "timing": "perfect", "info": {"max_score": 1000, "score": 500, "wrong": 0, "missed": 0, "perfect": 5, "great": 0, "good": 0, "current_streak": 5, "max_streak": 5}, "game_id": "test"} +{"type": "duration", "id": 6, "duration": "perfect", "info": {"max_score": 1000, "score": 500, "wrong": 0, "missed": 0, "perfect": 5, "great": 0, "good": 0, "current_streak": 5, "max_streak": 5}, "game_id": "test"} +{"type": "timing", "id": 7, "timing": "perfect", "info": {"max_score": 1000, "score": 600, "wrong": 0, "missed": 0, "perfect": 6, "great": 0, "good": 0, "current_streak": 6, "max_streak": 6}, "game_id": "test"} +{"type": "duration", "id": 7, "duration": "perfect", "info": {"max_score": 1000, "score": 600, "wrong": 0, "missed": 0, "perfect": 6, "great": 0, "good": 0, "current_streak": 6, "max_streak": 6}, "game_id": "test"} +{"type": "timing", "id": 8, "timing": "perfect", "info": {"max_score": 1000, "score": 700, "wrong": 0, "missed": 0, "perfect": 7, "great": 0, "good": 0, "current_streak": 7, "max_streak": 7}, "game_id": "test"} +{"type": "duration", "id": 8, "duration": "perfect", "info": {"max_score": 1000, "score": 700, "wrong": 0, "missed": 0, "perfect": 7, "great": 0, "good": 0, "current_streak": 7, "max_streak": 7}, "game_id": "test"} +{"type": "timing", "id": 9, "timing": "perfect", "info": {"max_score": 1000, "score": 800, "wrong": 0, "missed": 0, "perfect": 8, "great": 0, "good": 0, "current_streak": 8, "max_streak": 8}, "game_id": "test"} +{"type": "duration", "id": 9, "duration": "perfect", "info": {"max_score": 1000, "score": 800, "wrong": 0, "missed": 0, "perfect": 8, "great": 0, "good": 0, "current_streak": 8, "max_streak": 8}, "game_id": "test"} +{"type": "timing", "id": 10, "timing": "perfect", "info": {"max_score": 1000, "score": 900, "wrong": 0, "missed": 0, "perfect": 9, "great": 0, "good": 0, "current_streak": 9, "max_streak": 9}, "game_id": "test"} +{"type": "duration", "id": 10, "duration": "perfect", "info": {"max_score": 1000, "score": 900, "wrong": 0, "missed": 0, "perfect": 9, "great": 0, "good": 0, "current_streak": 9, "max_streak": 9}, "game_id": "test"} {"type": "end", "overallScore": 875, "precision": 90.0, "score": {"max_score": 1000, "score": 875, "wrong": 0, "missed": 1, "perfect": 9, "great": 0, "good": 0, "current_streak": 9, "max_streak": 9}} diff --git a/scorometer/tests/early/output b/scorometer/tests/early/output index ae22e6d..1cd5ea2 100644 --- a/scorometer/tests/early/output +++ b/scorometer/tests/early/output @@ -1,21 +1,21 @@ -{"type": "timing", "id": 1, "timing": "great", "info": {"max_score": 1000, "score": 75, "wrong": 0, "missed": 0, "perfect": 0, "great": 1, "good": 0, "current_streak": 1, "max_streak": 1}} -{"type": "duration", "id": 1, "duration": "perfect", "info": {"max_score": 1000, "score": 75, "wrong": 0, "missed": 0, "perfect": 0, "great": 1, "good": 0, "current_streak": 1, "max_streak": 1}} -{"type": "timing", "id": 2, "timing": "great", "info": {"max_score": 1000, "score": 150, "wrong": 0, "missed": 0, "perfect": 0, "great": 2, "good": 0, "current_streak": 2, "max_streak": 2}} -{"type": "duration", "id": 2, "duration": "perfect", "info": {"max_score": 1000, "score": 150, "wrong": 0, "missed": 0, "perfect": 0, "great": 2, "good": 0, "current_streak": 2, "max_streak": 2}} -{"type": "timing", "id": 3, "timing": "great", "info": {"max_score": 1000, "score": 225, "wrong": 0, "missed": 0, "perfect": 0, "great": 3, "good": 0, "current_streak": 3, "max_streak": 3}} -{"type": "duration", "id": 3, "duration": "perfect", "info": {"max_score": 1000, "score": 225, "wrong": 0, "missed": 0, "perfect": 0, "great": 3, "good": 0, "current_streak": 3, "max_streak": 3}} -{"type": "timing", "id": 4, "timing": "great", "info": {"max_score": 1000, "score": 300, "wrong": 0, "missed": 0, "perfect": 0, "great": 4, "good": 0, "current_streak": 4, "max_streak": 4}} -{"type": "duration", "id": 4, "duration": "perfect", "info": {"max_score": 1000, "score": 300, "wrong": 0, "missed": 0, "perfect": 0, "great": 4, "good": 0, "current_streak": 4, "max_streak": 4}} -{"type": "timing", "id": 5, "timing": "great", "info": {"max_score": 1000, "score": 375, "wrong": 0, "missed": 0, "perfect": 0, "great": 5, "good": 0, "current_streak": 5, "max_streak": 5}} -{"type": "duration", "id": 5, "duration": "perfect", "info": {"max_score": 1000, "score": 375, "wrong": 0, "missed": 0, "perfect": 0, "great": 5, "good": 0, "current_streak": 5, "max_streak": 5}} -{"type": "timing", "id": 6, "timing": "great", "info": {"max_score": 1000, "score": 450, "wrong": 0, "missed": 0, "perfect": 0, "great": 6, "good": 0, "current_streak": 6, "max_streak": 6}} -{"type": "duration", "id": 6, "duration": "perfect", "info": {"max_score": 1000, "score": 450, "wrong": 0, "missed": 0, "perfect": 0, "great": 6, "good": 0, "current_streak": 6, "max_streak": 6}} -{"type": "timing", "id": 7, "timing": "great", "info": {"max_score": 1000, "score": 525, "wrong": 0, "missed": 0, "perfect": 0, "great": 7, "good": 0, "current_streak": 7, "max_streak": 7}} -{"type": "duration", "id": 7, "duration": "perfect", "info": {"max_score": 1000, "score": 525, "wrong": 0, "missed": 0, "perfect": 0, "great": 7, "good": 0, "current_streak": 7, "max_streak": 7}} -{"type": "timing", "id": 8, "timing": "great", "info": {"max_score": 1000, "score": 600, "wrong": 0, "missed": 0, "perfect": 0, "great": 8, "good": 0, "current_streak": 8, "max_streak": 8}} -{"type": "duration", "id": 8, "duration": "perfect", "info": {"max_score": 1000, "score": 600, "wrong": 0, "missed": 0, "perfect": 0, "great": 8, "good": 0, "current_streak": 8, "max_streak": 8}} -{"type": "timing", "id": 9, "timing": "great", "info": {"max_score": 1000, "score": 675, "wrong": 0, "missed": 0, "perfect": 0, "great": 9, "good": 0, "current_streak": 9, "max_streak": 9}} -{"type": "duration", "id": 9, "duration": "perfect", "info": {"max_score": 1000, "score": 675, "wrong": 0, "missed": 0, "perfect": 0, "great": 9, "good": 0, "current_streak": 9, "max_streak": 9}} -{"type": "timing", "id": 10, "timing": "great", "info": {"max_score": 1000, "score": 750, "wrong": 0, "missed": 0, "perfect": 0, "great": 10, "good": 0, "current_streak": 10, "max_streak": 10}} -{"type": "duration", "id": 10, "duration": "perfect", "info": {"max_score": 1000, "score": 750, "wrong": 0, "missed": 0, "perfect": 0, "great": 10, "good": 0, "current_streak": 10, "max_streak": 10}} +{"type": "timing", "id": 1, "timing": "great", "info": {"max_score": 1000, "score": 75, "wrong": 0, "missed": 0, "perfect": 0, "great": 1, "good": 0, "current_streak": 1, "max_streak": 1}, "game_id": "test"} +{"type": "duration", "id": 1, "duration": "perfect", "info": {"max_score": 1000, "score": 75, "wrong": 0, "missed": 0, "perfect": 0, "great": 1, "good": 0, "current_streak": 1, "max_streak": 1}, "game_id": "test"} +{"type": "timing", "id": 2, "timing": "great", "info": {"max_score": 1000, "score": 150, "wrong": 0, "missed": 0, "perfect": 0, "great": 2, "good": 0, "current_streak": 2, "max_streak": 2}, "game_id": "test"} +{"type": "duration", "id": 2, "duration": "perfect", "info": {"max_score": 1000, "score": 150, "wrong": 0, "missed": 0, "perfect": 0, "great": 2, "good": 0, "current_streak": 2, "max_streak": 2}, "game_id": "test"} +{"type": "timing", "id": 3, "timing": "great", "info": {"max_score": 1000, "score": 225, "wrong": 0, "missed": 0, "perfect": 0, "great": 3, "good": 0, "current_streak": 3, "max_streak": 3}, "game_id": "test"} +{"type": "duration", "id": 3, "duration": "perfect", "info": {"max_score": 1000, "score": 225, "wrong": 0, "missed": 0, "perfect": 0, "great": 3, "good": 0, "current_streak": 3, "max_streak": 3}, "game_id": "test"} +{"type": "timing", "id": 4, "timing": "great", "info": {"max_score": 1000, "score": 300, "wrong": 0, "missed": 0, "perfect": 0, "great": 4, "good": 0, "current_streak": 4, "max_streak": 4}, "game_id": "test"} +{"type": "duration", "id": 4, "duration": "perfect", "info": {"max_score": 1000, "score": 300, "wrong": 0, "missed": 0, "perfect": 0, "great": 4, "good": 0, "current_streak": 4, "max_streak": 4}, "game_id": "test"} +{"type": "timing", "id": 5, "timing": "great", "info": {"max_score": 1000, "score": 375, "wrong": 0, "missed": 0, "perfect": 0, "great": 5, "good": 0, "current_streak": 5, "max_streak": 5}, "game_id": "test"} +{"type": "duration", "id": 5, "duration": "perfect", "info": {"max_score": 1000, "score": 375, "wrong": 0, "missed": 0, "perfect": 0, "great": 5, "good": 0, "current_streak": 5, "max_streak": 5}, "game_id": "test"} +{"type": "timing", "id": 6, "timing": "great", "info": {"max_score": 1000, "score": 450, "wrong": 0, "missed": 0, "perfect": 0, "great": 6, "good": 0, "current_streak": 6, "max_streak": 6}, "game_id": "test"} +{"type": "duration", "id": 6, "duration": "perfect", "info": {"max_score": 1000, "score": 450, "wrong": 0, "missed": 0, "perfect": 0, "great": 6, "good": 0, "current_streak": 6, "max_streak": 6}, "game_id": "test"} +{"type": "timing", "id": 7, "timing": "great", "info": {"max_score": 1000, "score": 525, "wrong": 0, "missed": 0, "perfect": 0, "great": 7, "good": 0, "current_streak": 7, "max_streak": 7}, "game_id": "test"} +{"type": "duration", "id": 7, "duration": "perfect", "info": {"max_score": 1000, "score": 525, "wrong": 0, "missed": 0, "perfect": 0, "great": 7, "good": 0, "current_streak": 7, "max_streak": 7}, "game_id": "test"} +{"type": "timing", "id": 8, "timing": "great", "info": {"max_score": 1000, "score": 600, "wrong": 0, "missed": 0, "perfect": 0, "great": 8, "good": 0, "current_streak": 8, "max_streak": 8}, "game_id": "test"} +{"type": "duration", "id": 8, "duration": "perfect", "info": {"max_score": 1000, "score": 600, "wrong": 0, "missed": 0, "perfect": 0, "great": 8, "good": 0, "current_streak": 8, "max_streak": 8}, "game_id": "test"} +{"type": "timing", "id": 9, "timing": "great", "info": {"max_score": 1000, "score": 675, "wrong": 0, "missed": 0, "perfect": 0, "great": 9, "good": 0, "current_streak": 9, "max_streak": 9}, "game_id": "test"} +{"type": "duration", "id": 9, "duration": "perfect", "info": {"max_score": 1000, "score": 675, "wrong": 0, "missed": 0, "perfect": 0, "great": 9, "good": 0, "current_streak": 9, "max_streak": 9}, "game_id": "test"} +{"type": "timing", "id": 10, "timing": "great", "info": {"max_score": 1000, "score": 750, "wrong": 0, "missed": 0, "perfect": 0, "great": 10, "good": 0, "current_streak": 10, "max_streak": 10}, "game_id": "test"} +{"type": "duration", "id": 10, "duration": "perfect", "info": {"max_score": 1000, "score": 750, "wrong": 0, "missed": 0, "perfect": 0, "great": 10, "good": 0, "current_streak": 10, "max_streak": 10}, "game_id": "test"} {"type": "end", "overallScore": 750, "precision": 100.0, "score": {"max_score": 1000, "score": 750, "wrong": 0, "missed": 0, "perfect": 0, "great": 10, "good": 0, "current_streak": 10, "max_streak": 10}} diff --git a/scorometer/tests/end_miss/output b/scorometer/tests/end_miss/output index a00048a..73a2177 100644 --- a/scorometer/tests/end_miss/output +++ b/scorometer/tests/end_miss/output @@ -1,17 +1,17 @@ -{"type": "timing", "id": 1, "timing": "perfect", "info": {"max_score": 1000, "score": 100, "wrong": 0, "missed": 0, "perfect": 1, "great": 0, "good": 0, "current_streak": 1, "max_streak": 1}} -{"type": "duration", "id": 1, "duration": "perfect", "info": {"max_score": 1000, "score": 100, "wrong": 0, "missed": 0, "perfect": 1, "great": 0, "good": 0, "current_streak": 1, "max_streak": 1}} -{"type": "timing", "id": 2, "timing": "perfect", "info": {"max_score": 1000, "score": 200, "wrong": 0, "missed": 0, "perfect": 2, "great": 0, "good": 0, "current_streak": 2, "max_streak": 2}} -{"type": "duration", "id": 2, "duration": "perfect", "info": {"max_score": 1000, "score": 200, "wrong": 0, "missed": 0, "perfect": 2, "great": 0, "good": 0, "current_streak": 2, "max_streak": 2}} -{"type": "timing", "id": 3, "timing": "perfect", "info": {"max_score": 1000, "score": 300, "wrong": 0, "missed": 0, "perfect": 3, "great": 0, "good": 0, "current_streak": 3, "max_streak": 3}} -{"type": "duration", "id": 3, "duration": "perfect", "info": {"max_score": 1000, "score": 300, "wrong": 0, "missed": 0, "perfect": 3, "great": 0, "good": 0, "current_streak": 3, "max_streak": 3}} -{"type": "timing", "id": 4, "timing": "perfect", "info": {"max_score": 1000, "score": 400, "wrong": 0, "missed": 0, "perfect": 4, "great": 0, "good": 0, "current_streak": 4, "max_streak": 4}} -{"type": "duration", "id": 4, "duration": "perfect", "info": {"max_score": 1000, "score": 400, "wrong": 0, "missed": 0, "perfect": 4, "great": 0, "good": 0, "current_streak": 4, "max_streak": 4}} -{"type": "timing", "id": 5, "timing": "perfect", "info": {"max_score": 1000, "score": 500, "wrong": 0, "missed": 0, "perfect": 5, "great": 0, "good": 0, "current_streak": 5, "max_streak": 5}} -{"type": "duration", "id": 5, "duration": "perfect", "info": {"max_score": 1000, "score": 500, "wrong": 0, "missed": 0, "perfect": 5, "great": 0, "good": 0, "current_streak": 5, "max_streak": 5}} -{"type": "timing", "id": 6, "timing": "perfect", "info": {"max_score": 1000, "score": 600, "wrong": 0, "missed": 0, "perfect": 6, "great": 0, "good": 0, "current_streak": 6, "max_streak": 6}} -{"type": "duration", "id": 6, "duration": "perfect", "info": {"max_score": 1000, "score": 600, "wrong": 0, "missed": 0, "perfect": 6, "great": 0, "good": 0, "current_streak": 6, "max_streak": 6}} -{"type": "timing", "id": 7, "timing": "perfect", "info": {"max_score": 1000, "score": 700, "wrong": 0, "missed": 0, "perfect": 7, "great": 0, "good": 0, "current_streak": 7, "max_streak": 7}} -{"type": "duration", "id": 7, "duration": "perfect", "info": {"max_score": 1000, "score": 700, "wrong": 0, "missed": 0, "perfect": 7, "great": 0, "good": 0, "current_streak": 7, "max_streak": 7}} -{"type": "timing", "id": 8, "timing": "perfect", "info": {"max_score": 1000, "score": 800, "wrong": 0, "missed": 0, "perfect": 8, "great": 0, "good": 0, "current_streak": 8, "max_streak": 8}} -{"type": "duration", "id": 8, "duration": "perfect", "info": {"max_score": 1000, "score": 800, "wrong": 0, "missed": 0, "perfect": 8, "great": 0, "good": 0, "current_streak": 8, "max_streak": 8}} +{"type": "timing", "id": 1, "timing": "perfect", "info": {"max_score": 1000, "score": 100, "wrong": 0, "missed": 0, "perfect": 1, "great": 0, "good": 0, "current_streak": 1, "max_streak": 1}, "game_id": "test"} +{"type": "duration", "id": 1, "duration": "perfect", "info": {"max_score": 1000, "score": 100, "wrong": 0, "missed": 0, "perfect": 1, "great": 0, "good": 0, "current_streak": 1, "max_streak": 1}, "game_id": "test"} +{"type": "timing", "id": 2, "timing": "perfect", "info": {"max_score": 1000, "score": 200, "wrong": 0, "missed": 0, "perfect": 2, "great": 0, "good": 0, "current_streak": 2, "max_streak": 2}, "game_id": "test"} +{"type": "duration", "id": 2, "duration": "perfect", "info": {"max_score": 1000, "score": 200, "wrong": 0, "missed": 0, "perfect": 2, "great": 0, "good": 0, "current_streak": 2, "max_streak": 2}, "game_id": "test"} +{"type": "timing", "id": 3, "timing": "perfect", "info": {"max_score": 1000, "score": 300, "wrong": 0, "missed": 0, "perfect": 3, "great": 0, "good": 0, "current_streak": 3, "max_streak": 3}, "game_id": "test"} +{"type": "duration", "id": 3, "duration": "perfect", "info": {"max_score": 1000, "score": 300, "wrong": 0, "missed": 0, "perfect": 3, "great": 0, "good": 0, "current_streak": 3, "max_streak": 3}, "game_id": "test"} +{"type": "timing", "id": 4, "timing": "perfect", "info": {"max_score": 1000, "score": 400, "wrong": 0, "missed": 0, "perfect": 4, "great": 0, "good": 0, "current_streak": 4, "max_streak": 4}, "game_id": "test"} +{"type": "duration", "id": 4, "duration": "perfect", "info": {"max_score": 1000, "score": 400, "wrong": 0, "missed": 0, "perfect": 4, "great": 0, "good": 0, "current_streak": 4, "max_streak": 4}, "game_id": "test"} +{"type": "timing", "id": 5, "timing": "perfect", "info": {"max_score": 1000, "score": 500, "wrong": 0, "missed": 0, "perfect": 5, "great": 0, "good": 0, "current_streak": 5, "max_streak": 5}, "game_id": "test"} +{"type": "duration", "id": 5, "duration": "perfect", "info": {"max_score": 1000, "score": 500, "wrong": 0, "missed": 0, "perfect": 5, "great": 0, "good": 0, "current_streak": 5, "max_streak": 5}, "game_id": "test"} +{"type": "timing", "id": 6, "timing": "perfect", "info": {"max_score": 1000, "score": 600, "wrong": 0, "missed": 0, "perfect": 6, "great": 0, "good": 0, "current_streak": 6, "max_streak": 6}, "game_id": "test"} +{"type": "duration", "id": 6, "duration": "perfect", "info": {"max_score": 1000, "score": 600, "wrong": 0, "missed": 0, "perfect": 6, "great": 0, "good": 0, "current_streak": 6, "max_streak": 6}, "game_id": "test"} +{"type": "timing", "id": 7, "timing": "perfect", "info": {"max_score": 1000, "score": 700, "wrong": 0, "missed": 0, "perfect": 7, "great": 0, "good": 0, "current_streak": 7, "max_streak": 7}, "game_id": "test"} +{"type": "duration", "id": 7, "duration": "perfect", "info": {"max_score": 1000, "score": 700, "wrong": 0, "missed": 0, "perfect": 7, "great": 0, "good": 0, "current_streak": 7, "max_streak": 7}, "game_id": "test"} +{"type": "timing", "id": 8, "timing": "perfect", "info": {"max_score": 1000, "score": 800, "wrong": 0, "missed": 0, "perfect": 8, "great": 0, "good": 0, "current_streak": 8, "max_streak": 8}, "game_id": "test"} +{"type": "duration", "id": 8, "duration": "perfect", "info": {"max_score": 1000, "score": 800, "wrong": 0, "missed": 0, "perfect": 8, "great": 0, "good": 0, "current_streak": 8, "max_streak": 8}, "game_id": "test"} {"type": "end", "overallScore": 750, "precision": 80.0, "score": {"max_score": 1000, "score": 750, "wrong": 0, "missed": 2, "perfect": 8, "great": 0, "good": 0, "current_streak": 8, "max_streak": 8}} diff --git a/scorometer/tests/hold_not_enough/output b/scorometer/tests/hold_not_enough/output index 1d9547a..cb61f21 100644 --- a/scorometer/tests/hold_not_enough/output +++ b/scorometer/tests/hold_not_enough/output @@ -1,21 +1,21 @@ -{"type": "timing", "id": 1, "timing": "perfect", "info": {"max_score": 1000, "score": 100, "wrong": 0, "missed": 0, "perfect": 1, "great": 0, "good": 0, "current_streak": 1, "max_streak": 1}} -{"type": "duration", "id": 1, "duration": "too short", "info": {"max_score": 1000, "score": 100, "wrong": 0, "missed": 0, "perfect": 1, "great": 0, "good": 0, "current_streak": 1, "max_streak": 1}} -{"type": "timing", "id": 2, "timing": "perfect", "info": {"max_score": 1000, "score": 200, "wrong": 0, "missed": 0, "perfect": 2, "great": 0, "good": 0, "current_streak": 2, "max_streak": 2}} -{"type": "duration", "id": 2, "duration": "too short", "info": {"max_score": 1000, "score": 200, "wrong": 0, "missed": 0, "perfect": 2, "great": 0, "good": 0, "current_streak": 2, "max_streak": 2}} -{"type": "timing", "id": 3, "timing": "perfect", "info": {"max_score": 1000, "score": 300, "wrong": 0, "missed": 0, "perfect": 3, "great": 0, "good": 0, "current_streak": 3, "max_streak": 3}} -{"type": "duration", "id": 3, "duration": "too short", "info": {"max_score": 1000, "score": 300, "wrong": 0, "missed": 0, "perfect": 3, "great": 0, "good": 0, "current_streak": 3, "max_streak": 3}} -{"type": "timing", "id": 4, "timing": "perfect", "info": {"max_score": 1000, "score": 400, "wrong": 0, "missed": 0, "perfect": 4, "great": 0, "good": 0, "current_streak": 4, "max_streak": 4}} -{"type": "duration", "id": 4, "duration": "too short", "info": {"max_score": 1000, "score": 400, "wrong": 0, "missed": 0, "perfect": 4, "great": 0, "good": 0, "current_streak": 4, "max_streak": 4}} -{"type": "timing", "id": 5, "timing": "perfect", "info": {"max_score": 1000, "score": 500, "wrong": 0, "missed": 0, "perfect": 5, "great": 0, "good": 0, "current_streak": 5, "max_streak": 5}} -{"type": "duration", "id": 5, "duration": "too short", "info": {"max_score": 1000, "score": 500, "wrong": 0, "missed": 0, "perfect": 5, "great": 0, "good": 0, "current_streak": 5, "max_streak": 5}} -{"type": "timing", "id": 6, "timing": "perfect", "info": {"max_score": 1000, "score": 600, "wrong": 0, "missed": 0, "perfect": 6, "great": 0, "good": 0, "current_streak": 6, "max_streak": 6}} -{"type": "duration", "id": 6, "duration": "too short", "info": {"max_score": 1000, "score": 600, "wrong": 0, "missed": 0, "perfect": 6, "great": 0, "good": 0, "current_streak": 6, "max_streak": 6}} -{"type": "timing", "id": 7, "timing": "perfect", "info": {"max_score": 1000, "score": 700, "wrong": 0, "missed": 0, "perfect": 7, "great": 0, "good": 0, "current_streak": 7, "max_streak": 7}} -{"type": "duration", "id": 7, "duration": "too short", "info": {"max_score": 1000, "score": 700, "wrong": 0, "missed": 0, "perfect": 7, "great": 0, "good": 0, "current_streak": 7, "max_streak": 7}} -{"type": "timing", "id": 8, "timing": "perfect", "info": {"max_score": 1000, "score": 800, "wrong": 0, "missed": 0, "perfect": 8, "great": 0, "good": 0, "current_streak": 8, "max_streak": 8}} -{"type": "duration", "id": 8, "duration": "too short", "info": {"max_score": 1000, "score": 800, "wrong": 0, "missed": 0, "perfect": 8, "great": 0, "good": 0, "current_streak": 8, "max_streak": 8}} -{"type": "timing", "id": 9, "timing": "perfect", "info": {"max_score": 1000, "score": 900, "wrong": 0, "missed": 0, "perfect": 9, "great": 0, "good": 0, "current_streak": 9, "max_streak": 9}} -{"type": "duration", "id": 9, "duration": "too short", "info": {"max_score": 1000, "score": 900, "wrong": 0, "missed": 0, "perfect": 9, "great": 0, "good": 0, "current_streak": 9, "max_streak": 9}} -{"type": "timing", "id": 10, "timing": "perfect", "info": {"max_score": 1000, "score": 1000, "wrong": 0, "missed": 0, "perfect": 10, "great": 0, "good": 0, "current_streak": 10, "max_streak": 10}} -{"type": "duration", "id": 10, "duration": "too short", "info": {"max_score": 1000, "score": 1000, "wrong": 0, "missed": 0, "perfect": 10, "great": 0, "good": 0, "current_streak": 10, "max_streak": 10}} +{"type": "timing", "id": 1, "timing": "perfect", "info": {"max_score": 1000, "score": 100, "wrong": 0, "missed": 0, "perfect": 1, "great": 0, "good": 0, "current_streak": 1, "max_streak": 1}, "game_id": "test"} +{"type": "duration", "id": 1, "duration": "too short", "info": {"max_score": 1000, "score": 100, "wrong": 0, "missed": 0, "perfect": 1, "great": 0, "good": 0, "current_streak": 1, "max_streak": 1}, "game_id": "test"} +{"type": "timing", "id": 2, "timing": "perfect", "info": {"max_score": 1000, "score": 200, "wrong": 0, "missed": 0, "perfect": 2, "great": 0, "good": 0, "current_streak": 2, "max_streak": 2}, "game_id": "test"} +{"type": "duration", "id": 2, "duration": "too short", "info": {"max_score": 1000, "score": 200, "wrong": 0, "missed": 0, "perfect": 2, "great": 0, "good": 0, "current_streak": 2, "max_streak": 2}, "game_id": "test"} +{"type": "timing", "id": 3, "timing": "perfect", "info": {"max_score": 1000, "score": 300, "wrong": 0, "missed": 0, "perfect": 3, "great": 0, "good": 0, "current_streak": 3, "max_streak": 3}, "game_id": "test"} +{"type": "duration", "id": 3, "duration": "too short", "info": {"max_score": 1000, "score": 300, "wrong": 0, "missed": 0, "perfect": 3, "great": 0, "good": 0, "current_streak": 3, "max_streak": 3}, "game_id": "test"} +{"type": "timing", "id": 4, "timing": "perfect", "info": {"max_score": 1000, "score": 400, "wrong": 0, "missed": 0, "perfect": 4, "great": 0, "good": 0, "current_streak": 4, "max_streak": 4}, "game_id": "test"} +{"type": "duration", "id": 4, "duration": "too short", "info": {"max_score": 1000, "score": 400, "wrong": 0, "missed": 0, "perfect": 4, "great": 0, "good": 0, "current_streak": 4, "max_streak": 4}, "game_id": "test"} +{"type": "timing", "id": 5, "timing": "perfect", "info": {"max_score": 1000, "score": 500, "wrong": 0, "missed": 0, "perfect": 5, "great": 0, "good": 0, "current_streak": 5, "max_streak": 5}, "game_id": "test"} +{"type": "duration", "id": 5, "duration": "too short", "info": {"max_score": 1000, "score": 500, "wrong": 0, "missed": 0, "perfect": 5, "great": 0, "good": 0, "current_streak": 5, "max_streak": 5}, "game_id": "test"} +{"type": "timing", "id": 6, "timing": "perfect", "info": {"max_score": 1000, "score": 600, "wrong": 0, "missed": 0, "perfect": 6, "great": 0, "good": 0, "current_streak": 6, "max_streak": 6}, "game_id": "test"} +{"type": "duration", "id": 6, "duration": "too short", "info": {"max_score": 1000, "score": 600, "wrong": 0, "missed": 0, "perfect": 6, "great": 0, "good": 0, "current_streak": 6, "max_streak": 6}, "game_id": "test"} +{"type": "timing", "id": 7, "timing": "perfect", "info": {"max_score": 1000, "score": 700, "wrong": 0, "missed": 0, "perfect": 7, "great": 0, "good": 0, "current_streak": 7, "max_streak": 7}, "game_id": "test"} +{"type": "duration", "id": 7, "duration": "too short", "info": {"max_score": 1000, "score": 700, "wrong": 0, "missed": 0, "perfect": 7, "great": 0, "good": 0, "current_streak": 7, "max_streak": 7}, "game_id": "test"} +{"type": "timing", "id": 8, "timing": "perfect", "info": {"max_score": 1000, "score": 800, "wrong": 0, "missed": 0, "perfect": 8, "great": 0, "good": 0, "current_streak": 8, "max_streak": 8}, "game_id": "test"} +{"type": "duration", "id": 8, "duration": "too short", "info": {"max_score": 1000, "score": 800, "wrong": 0, "missed": 0, "perfect": 8, "great": 0, "good": 0, "current_streak": 8, "max_streak": 8}, "game_id": "test"} +{"type": "timing", "id": 9, "timing": "perfect", "info": {"max_score": 1000, "score": 900, "wrong": 0, "missed": 0, "perfect": 9, "great": 0, "good": 0, "current_streak": 9, "max_streak": 9}, "game_id": "test"} +{"type": "duration", "id": 9, "duration": "too short", "info": {"max_score": 1000, "score": 900, "wrong": 0, "missed": 0, "perfect": 9, "great": 0, "good": 0, "current_streak": 9, "max_streak": 9}, "game_id": "test"} +{"type": "timing", "id": 10, "timing": "perfect", "info": {"max_score": 1000, "score": 1000, "wrong": 0, "missed": 0, "perfect": 10, "great": 0, "good": 0, "current_streak": 10, "max_streak": 10}, "game_id": "test"} +{"type": "duration", "id": 10, "duration": "too short", "info": {"max_score": 1000, "score": 1000, "wrong": 0, "missed": 0, "perfect": 10, "great": 0, "good": 0, "current_streak": 10, "max_streak": 10}, "game_id": "test"} {"type": "end", "overallScore": 1000, "precision": 100.0, "score": {"max_score": 1000, "score": 1000, "wrong": 0, "missed": 0, "perfect": 10, "great": 0, "good": 0, "current_streak": 10, "max_streak": 10}} diff --git a/scorometer/tests/hold_too_long/output b/scorometer/tests/hold_too_long/output index 31add7c..f3ee3de 100644 --- a/scorometer/tests/hold_too_long/output +++ b/scorometer/tests/hold_too_long/output @@ -1,21 +1,21 @@ -{"type": "timing", "id": 1, "timing": "perfect", "info": {"max_score": 1000, "score": 100, "wrong": 0, "missed": 0, "perfect": 1, "great": 0, "good": 0, "current_streak": 1, "max_streak": 1}} -{"type": "duration", "id": 1, "duration": "too long", "info": {"max_score": 1000, "score": 100, "wrong": 0, "missed": 0, "perfect": 1, "great": 0, "good": 0, "current_streak": 1, "max_streak": 1}} -{"type": "timing", "id": 2, "timing": "perfect", "info": {"max_score": 1000, "score": 200, "wrong": 0, "missed": 0, "perfect": 2, "great": 0, "good": 0, "current_streak": 2, "max_streak": 2}} -{"type": "duration", "id": 2, "duration": "too long", "info": {"max_score": 1000, "score": 200, "wrong": 0, "missed": 0, "perfect": 2, "great": 0, "good": 0, "current_streak": 2, "max_streak": 2}} -{"type": "timing", "id": 3, "timing": "perfect", "info": {"max_score": 1000, "score": 300, "wrong": 0, "missed": 0, "perfect": 3, "great": 0, "good": 0, "current_streak": 3, "max_streak": 3}} -{"type": "duration", "id": 3, "duration": "too long", "info": {"max_score": 1000, "score": 300, "wrong": 0, "missed": 0, "perfect": 3, "great": 0, "good": 0, "current_streak": 3, "max_streak": 3}} -{"type": "timing", "id": 4, "timing": "perfect", "info": {"max_score": 1000, "score": 400, "wrong": 0, "missed": 0, "perfect": 4, "great": 0, "good": 0, "current_streak": 4, "max_streak": 4}} -{"type": "duration", "id": 4, "duration": "too long", "info": {"max_score": 1000, "score": 400, "wrong": 0, "missed": 0, "perfect": 4, "great": 0, "good": 0, "current_streak": 4, "max_streak": 4}} -{"type": "timing", "id": 5, "timing": "perfect", "info": {"max_score": 1000, "score": 500, "wrong": 0, "missed": 0, "perfect": 5, "great": 0, "good": 0, "current_streak": 5, "max_streak": 5}} -{"type": "duration", "id": 5, "duration": "too long", "info": {"max_score": 1000, "score": 500, "wrong": 0, "missed": 0, "perfect": 5, "great": 0, "good": 0, "current_streak": 5, "max_streak": 5}} -{"type": "timing", "id": 6, "timing": "perfect", "info": {"max_score": 1000, "score": 600, "wrong": 0, "missed": 0, "perfect": 6, "great": 0, "good": 0, "current_streak": 6, "max_streak": 6}} -{"type": "duration", "id": 6, "duration": "too long", "info": {"max_score": 1000, "score": 600, "wrong": 0, "missed": 0, "perfect": 6, "great": 0, "good": 0, "current_streak": 6, "max_streak": 6}} -{"type": "timing", "id": 7, "timing": "perfect", "info": {"max_score": 1000, "score": 700, "wrong": 0, "missed": 0, "perfect": 7, "great": 0, "good": 0, "current_streak": 7, "max_streak": 7}} -{"type": "duration", "id": 7, "duration": "too long", "info": {"max_score": 1000, "score": 700, "wrong": 0, "missed": 0, "perfect": 7, "great": 0, "good": 0, "current_streak": 7, "max_streak": 7}} -{"type": "timing", "id": 8, "timing": "perfect", "info": {"max_score": 1000, "score": 800, "wrong": 0, "missed": 0, "perfect": 8, "great": 0, "good": 0, "current_streak": 8, "max_streak": 8}} -{"type": "duration", "id": 8, "duration": "too long", "info": {"max_score": 1000, "score": 800, "wrong": 0, "missed": 0, "perfect": 8, "great": 0, "good": 0, "current_streak": 8, "max_streak": 8}} -{"type": "timing", "id": 9, "timing": "perfect", "info": {"max_score": 1000, "score": 900, "wrong": 0, "missed": 0, "perfect": 9, "great": 0, "good": 0, "current_streak": 9, "max_streak": 9}} -{"type": "duration", "id": 9, "duration": "too long", "info": {"max_score": 1000, "score": 900, "wrong": 0, "missed": 0, "perfect": 9, "great": 0, "good": 0, "current_streak": 9, "max_streak": 9}} -{"type": "timing", "id": 10, "timing": "perfect", "info": {"max_score": 1000, "score": 1000, "wrong": 0, "missed": 0, "perfect": 10, "great": 0, "good": 0, "current_streak": 10, "max_streak": 10}} -{"type": "duration", "id": 10, "duration": "too long", "info": {"max_score": 1000, "score": 1000, "wrong": 0, "missed": 0, "perfect": 10, "great": 0, "good": 0, "current_streak": 10, "max_streak": 10}} +{"type": "timing", "id": 1, "timing": "perfect", "info": {"max_score": 1000, "score": 100, "wrong": 0, "missed": 0, "perfect": 1, "great": 0, "good": 0, "current_streak": 1, "max_streak": 1}, "game_id": "test"} +{"type": "duration", "id": 1, "duration": "too long", "info": {"max_score": 1000, "score": 100, "wrong": 0, "missed": 0, "perfect": 1, "great": 0, "good": 0, "current_streak": 1, "max_streak": 1}, "game_id": "test"} +{"type": "timing", "id": 2, "timing": "perfect", "info": {"max_score": 1000, "score": 200, "wrong": 0, "missed": 0, "perfect": 2, "great": 0, "good": 0, "current_streak": 2, "max_streak": 2}, "game_id": "test"} +{"type": "duration", "id": 2, "duration": "too long", "info": {"max_score": 1000, "score": 200, "wrong": 0, "missed": 0, "perfect": 2, "great": 0, "good": 0, "current_streak": 2, "max_streak": 2}, "game_id": "test"} +{"type": "timing", "id": 3, "timing": "perfect", "info": {"max_score": 1000, "score": 300, "wrong": 0, "missed": 0, "perfect": 3, "great": 0, "good": 0, "current_streak": 3, "max_streak": 3}, "game_id": "test"} +{"type": "duration", "id": 3, "duration": "too long", "info": {"max_score": 1000, "score": 300, "wrong": 0, "missed": 0, "perfect": 3, "great": 0, "good": 0, "current_streak": 3, "max_streak": 3}, "game_id": "test"} +{"type": "timing", "id": 4, "timing": "perfect", "info": {"max_score": 1000, "score": 400, "wrong": 0, "missed": 0, "perfect": 4, "great": 0, "good": 0, "current_streak": 4, "max_streak": 4}, "game_id": "test"} +{"type": "duration", "id": 4, "duration": "too long", "info": {"max_score": 1000, "score": 400, "wrong": 0, "missed": 0, "perfect": 4, "great": 0, "good": 0, "current_streak": 4, "max_streak": 4}, "game_id": "test"} +{"type": "timing", "id": 5, "timing": "perfect", "info": {"max_score": 1000, "score": 500, "wrong": 0, "missed": 0, "perfect": 5, "great": 0, "good": 0, "current_streak": 5, "max_streak": 5}, "game_id": "test"} +{"type": "duration", "id": 5, "duration": "too long", "info": {"max_score": 1000, "score": 500, "wrong": 0, "missed": 0, "perfect": 5, "great": 0, "good": 0, "current_streak": 5, "max_streak": 5}, "game_id": "test"} +{"type": "timing", "id": 6, "timing": "perfect", "info": {"max_score": 1000, "score": 600, "wrong": 0, "missed": 0, "perfect": 6, "great": 0, "good": 0, "current_streak": 6, "max_streak": 6}, "game_id": "test"} +{"type": "duration", "id": 6, "duration": "too long", "info": {"max_score": 1000, "score": 600, "wrong": 0, "missed": 0, "perfect": 6, "great": 0, "good": 0, "current_streak": 6, "max_streak": 6}, "game_id": "test"} +{"type": "timing", "id": 7, "timing": "perfect", "info": {"max_score": 1000, "score": 700, "wrong": 0, "missed": 0, "perfect": 7, "great": 0, "good": 0, "current_streak": 7, "max_streak": 7}, "game_id": "test"} +{"type": "duration", "id": 7, "duration": "too long", "info": {"max_score": 1000, "score": 700, "wrong": 0, "missed": 0, "perfect": 7, "great": 0, "good": 0, "current_streak": 7, "max_streak": 7}, "game_id": "test"} +{"type": "timing", "id": 8, "timing": "perfect", "info": {"max_score": 1000, "score": 800, "wrong": 0, "missed": 0, "perfect": 8, "great": 0, "good": 0, "current_streak": 8, "max_streak": 8}, "game_id": "test"} +{"type": "duration", "id": 8, "duration": "too long", "info": {"max_score": 1000, "score": 800, "wrong": 0, "missed": 0, "perfect": 8, "great": 0, "good": 0, "current_streak": 8, "max_streak": 8}, "game_id": "test"} +{"type": "timing", "id": 9, "timing": "perfect", "info": {"max_score": 1000, "score": 900, "wrong": 0, "missed": 0, "perfect": 9, "great": 0, "good": 0, "current_streak": 9, "max_streak": 9}, "game_id": "test"} +{"type": "duration", "id": 9, "duration": "too long", "info": {"max_score": 1000, "score": 900, "wrong": 0, "missed": 0, "perfect": 9, "great": 0, "good": 0, "current_streak": 9, "max_streak": 9}, "game_id": "test"} +{"type": "timing", "id": 10, "timing": "perfect", "info": {"max_score": 1000, "score": 1000, "wrong": 0, "missed": 0, "perfect": 10, "great": 0, "good": 0, "current_streak": 10, "max_streak": 10}, "game_id": "test"} +{"type": "duration", "id": 10, "duration": "too long", "info": {"max_score": 1000, "score": 1000, "wrong": 0, "missed": 0, "perfect": 10, "great": 0, "good": 0, "current_streak": 10, "max_streak": 10}, "game_id": "test"} {"type": "end", "overallScore": 1000, "precision": 100.0, "score": {"max_score": 1000, "score": 1000, "wrong": 0, "missed": 0, "perfect": 10, "great": 0, "good": 0, "current_streak": 10, "max_streak": 10}} diff --git a/scorometer/tests/late/output b/scorometer/tests/late/output index ae22e6d..1cd5ea2 100644 --- a/scorometer/tests/late/output +++ b/scorometer/tests/late/output @@ -1,21 +1,21 @@ -{"type": "timing", "id": 1, "timing": "great", "info": {"max_score": 1000, "score": 75, "wrong": 0, "missed": 0, "perfect": 0, "great": 1, "good": 0, "current_streak": 1, "max_streak": 1}} -{"type": "duration", "id": 1, "duration": "perfect", "info": {"max_score": 1000, "score": 75, "wrong": 0, "missed": 0, "perfect": 0, "great": 1, "good": 0, "current_streak": 1, "max_streak": 1}} -{"type": "timing", "id": 2, "timing": "great", "info": {"max_score": 1000, "score": 150, "wrong": 0, "missed": 0, "perfect": 0, "great": 2, "good": 0, "current_streak": 2, "max_streak": 2}} -{"type": "duration", "id": 2, "duration": "perfect", "info": {"max_score": 1000, "score": 150, "wrong": 0, "missed": 0, "perfect": 0, "great": 2, "good": 0, "current_streak": 2, "max_streak": 2}} -{"type": "timing", "id": 3, "timing": "great", "info": {"max_score": 1000, "score": 225, "wrong": 0, "missed": 0, "perfect": 0, "great": 3, "good": 0, "current_streak": 3, "max_streak": 3}} -{"type": "duration", "id": 3, "duration": "perfect", "info": {"max_score": 1000, "score": 225, "wrong": 0, "missed": 0, "perfect": 0, "great": 3, "good": 0, "current_streak": 3, "max_streak": 3}} -{"type": "timing", "id": 4, "timing": "great", "info": {"max_score": 1000, "score": 300, "wrong": 0, "missed": 0, "perfect": 0, "great": 4, "good": 0, "current_streak": 4, "max_streak": 4}} -{"type": "duration", "id": 4, "duration": "perfect", "info": {"max_score": 1000, "score": 300, "wrong": 0, "missed": 0, "perfect": 0, "great": 4, "good": 0, "current_streak": 4, "max_streak": 4}} -{"type": "timing", "id": 5, "timing": "great", "info": {"max_score": 1000, "score": 375, "wrong": 0, "missed": 0, "perfect": 0, "great": 5, "good": 0, "current_streak": 5, "max_streak": 5}} -{"type": "duration", "id": 5, "duration": "perfect", "info": {"max_score": 1000, "score": 375, "wrong": 0, "missed": 0, "perfect": 0, "great": 5, "good": 0, "current_streak": 5, "max_streak": 5}} -{"type": "timing", "id": 6, "timing": "great", "info": {"max_score": 1000, "score": 450, "wrong": 0, "missed": 0, "perfect": 0, "great": 6, "good": 0, "current_streak": 6, "max_streak": 6}} -{"type": "duration", "id": 6, "duration": "perfect", "info": {"max_score": 1000, "score": 450, "wrong": 0, "missed": 0, "perfect": 0, "great": 6, "good": 0, "current_streak": 6, "max_streak": 6}} -{"type": "timing", "id": 7, "timing": "great", "info": {"max_score": 1000, "score": 525, "wrong": 0, "missed": 0, "perfect": 0, "great": 7, "good": 0, "current_streak": 7, "max_streak": 7}} -{"type": "duration", "id": 7, "duration": "perfect", "info": {"max_score": 1000, "score": 525, "wrong": 0, "missed": 0, "perfect": 0, "great": 7, "good": 0, "current_streak": 7, "max_streak": 7}} -{"type": "timing", "id": 8, "timing": "great", "info": {"max_score": 1000, "score": 600, "wrong": 0, "missed": 0, "perfect": 0, "great": 8, "good": 0, "current_streak": 8, "max_streak": 8}} -{"type": "duration", "id": 8, "duration": "perfect", "info": {"max_score": 1000, "score": 600, "wrong": 0, "missed": 0, "perfect": 0, "great": 8, "good": 0, "current_streak": 8, "max_streak": 8}} -{"type": "timing", "id": 9, "timing": "great", "info": {"max_score": 1000, "score": 675, "wrong": 0, "missed": 0, "perfect": 0, "great": 9, "good": 0, "current_streak": 9, "max_streak": 9}} -{"type": "duration", "id": 9, "duration": "perfect", "info": {"max_score": 1000, "score": 675, "wrong": 0, "missed": 0, "perfect": 0, "great": 9, "good": 0, "current_streak": 9, "max_streak": 9}} -{"type": "timing", "id": 10, "timing": "great", "info": {"max_score": 1000, "score": 750, "wrong": 0, "missed": 0, "perfect": 0, "great": 10, "good": 0, "current_streak": 10, "max_streak": 10}} -{"type": "duration", "id": 10, "duration": "perfect", "info": {"max_score": 1000, "score": 750, "wrong": 0, "missed": 0, "perfect": 0, "great": 10, "good": 0, "current_streak": 10, "max_streak": 10}} +{"type": "timing", "id": 1, "timing": "great", "info": {"max_score": 1000, "score": 75, "wrong": 0, "missed": 0, "perfect": 0, "great": 1, "good": 0, "current_streak": 1, "max_streak": 1}, "game_id": "test"} +{"type": "duration", "id": 1, "duration": "perfect", "info": {"max_score": 1000, "score": 75, "wrong": 0, "missed": 0, "perfect": 0, "great": 1, "good": 0, "current_streak": 1, "max_streak": 1}, "game_id": "test"} +{"type": "timing", "id": 2, "timing": "great", "info": {"max_score": 1000, "score": 150, "wrong": 0, "missed": 0, "perfect": 0, "great": 2, "good": 0, "current_streak": 2, "max_streak": 2}, "game_id": "test"} +{"type": "duration", "id": 2, "duration": "perfect", "info": {"max_score": 1000, "score": 150, "wrong": 0, "missed": 0, "perfect": 0, "great": 2, "good": 0, "current_streak": 2, "max_streak": 2}, "game_id": "test"} +{"type": "timing", "id": 3, "timing": "great", "info": {"max_score": 1000, "score": 225, "wrong": 0, "missed": 0, "perfect": 0, "great": 3, "good": 0, "current_streak": 3, "max_streak": 3}, "game_id": "test"} +{"type": "duration", "id": 3, "duration": "perfect", "info": {"max_score": 1000, "score": 225, "wrong": 0, "missed": 0, "perfect": 0, "great": 3, "good": 0, "current_streak": 3, "max_streak": 3}, "game_id": "test"} +{"type": "timing", "id": 4, "timing": "great", "info": {"max_score": 1000, "score": 300, "wrong": 0, "missed": 0, "perfect": 0, "great": 4, "good": 0, "current_streak": 4, "max_streak": 4}, "game_id": "test"} +{"type": "duration", "id": 4, "duration": "perfect", "info": {"max_score": 1000, "score": 300, "wrong": 0, "missed": 0, "perfect": 0, "great": 4, "good": 0, "current_streak": 4, "max_streak": 4}, "game_id": "test"} +{"type": "timing", "id": 5, "timing": "great", "info": {"max_score": 1000, "score": 375, "wrong": 0, "missed": 0, "perfect": 0, "great": 5, "good": 0, "current_streak": 5, "max_streak": 5}, "game_id": "test"} +{"type": "duration", "id": 5, "duration": "perfect", "info": {"max_score": 1000, "score": 375, "wrong": 0, "missed": 0, "perfect": 0, "great": 5, "good": 0, "current_streak": 5, "max_streak": 5}, "game_id": "test"} +{"type": "timing", "id": 6, "timing": "great", "info": {"max_score": 1000, "score": 450, "wrong": 0, "missed": 0, "perfect": 0, "great": 6, "good": 0, "current_streak": 6, "max_streak": 6}, "game_id": "test"} +{"type": "duration", "id": 6, "duration": "perfect", "info": {"max_score": 1000, "score": 450, "wrong": 0, "missed": 0, "perfect": 0, "great": 6, "good": 0, "current_streak": 6, "max_streak": 6}, "game_id": "test"} +{"type": "timing", "id": 7, "timing": "great", "info": {"max_score": 1000, "score": 525, "wrong": 0, "missed": 0, "perfect": 0, "great": 7, "good": 0, "current_streak": 7, "max_streak": 7}, "game_id": "test"} +{"type": "duration", "id": 7, "duration": "perfect", "info": {"max_score": 1000, "score": 525, "wrong": 0, "missed": 0, "perfect": 0, "great": 7, "good": 0, "current_streak": 7, "max_streak": 7}, "game_id": "test"} +{"type": "timing", "id": 8, "timing": "great", "info": {"max_score": 1000, "score": 600, "wrong": 0, "missed": 0, "perfect": 0, "great": 8, "good": 0, "current_streak": 8, "max_streak": 8}, "game_id": "test"} +{"type": "duration", "id": 8, "duration": "perfect", "info": {"max_score": 1000, "score": 600, "wrong": 0, "missed": 0, "perfect": 0, "great": 8, "good": 0, "current_streak": 8, "max_streak": 8}, "game_id": "test"} +{"type": "timing", "id": 9, "timing": "great", "info": {"max_score": 1000, "score": 675, "wrong": 0, "missed": 0, "perfect": 0, "great": 9, "good": 0, "current_streak": 9, "max_streak": 9}, "game_id": "test"} +{"type": "duration", "id": 9, "duration": "perfect", "info": {"max_score": 1000, "score": 675, "wrong": 0, "missed": 0, "perfect": 0, "great": 9, "good": 0, "current_streak": 9, "max_streak": 9}, "game_id": "test"} +{"type": "timing", "id": 10, "timing": "great", "info": {"max_score": 1000, "score": 750, "wrong": 0, "missed": 0, "perfect": 0, "great": 10, "good": 0, "current_streak": 10, "max_streak": 10}, "game_id": "test"} +{"type": "duration", "id": 10, "duration": "perfect", "info": {"max_score": 1000, "score": 750, "wrong": 0, "missed": 0, "perfect": 0, "great": 10, "good": 0, "current_streak": 10, "max_streak": 10}, "game_id": "test"} {"type": "end", "overallScore": 750, "precision": 100.0, "score": {"max_score": 1000, "score": 750, "wrong": 0, "missed": 0, "perfect": 0, "great": 10, "good": 0, "current_streak": 10, "max_streak": 10}} diff --git a/scorometer/tests/perfect_play/output b/scorometer/tests/perfect_play/output index 7cc0181..ddae037 100644 --- a/scorometer/tests/perfect_play/output +++ b/scorometer/tests/perfect_play/output @@ -1,21 +1,21 @@ -{"type": "timing", "id": 1, "timing": "perfect", "info": {"max_score": 1000, "score": 100, "wrong": 0, "missed": 0, "perfect": 1, "great": 0, "good": 0, "current_streak": 1, "max_streak": 1}} -{"type": "duration", "id": 1, "duration": "perfect", "info": {"max_score": 1000, "score": 100, "wrong": 0, "missed": 0, "perfect": 1, "great": 0, "good": 0, "current_streak": 1, "max_streak": 1}} -{"type": "timing", "id": 2, "timing": "perfect", "info": {"max_score": 1000, "score": 200, "wrong": 0, "missed": 0, "perfect": 2, "great": 0, "good": 0, "current_streak": 2, "max_streak": 2}} -{"type": "duration", "id": 2, "duration": "perfect", "info": {"max_score": 1000, "score": 200, "wrong": 0, "missed": 0, "perfect": 2, "great": 0, "good": 0, "current_streak": 2, "max_streak": 2}} -{"type": "timing", "id": 3, "timing": "perfect", "info": {"max_score": 1000, "score": 300, "wrong": 0, "missed": 0, "perfect": 3, "great": 0, "good": 0, "current_streak": 3, "max_streak": 3}} -{"type": "duration", "id": 3, "duration": "perfect", "info": {"max_score": 1000, "score": 300, "wrong": 0, "missed": 0, "perfect": 3, "great": 0, "good": 0, "current_streak": 3, "max_streak": 3}} -{"type": "timing", "id": 4, "timing": "perfect", "info": {"max_score": 1000, "score": 400, "wrong": 0, "missed": 0, "perfect": 4, "great": 0, "good": 0, "current_streak": 4, "max_streak": 4}} -{"type": "duration", "id": 4, "duration": "perfect", "info": {"max_score": 1000, "score": 400, "wrong": 0, "missed": 0, "perfect": 4, "great": 0, "good": 0, "current_streak": 4, "max_streak": 4}} -{"type": "timing", "id": 5, "timing": "perfect", "info": {"max_score": 1000, "score": 500, "wrong": 0, "missed": 0, "perfect": 5, "great": 0, "good": 0, "current_streak": 5, "max_streak": 5}} -{"type": "duration", "id": 5, "duration": "perfect", "info": {"max_score": 1000, "score": 500, "wrong": 0, "missed": 0, "perfect": 5, "great": 0, "good": 0, "current_streak": 5, "max_streak": 5}} -{"type": "timing", "id": 6, "timing": "perfect", "info": {"max_score": 1000, "score": 600, "wrong": 0, "missed": 0, "perfect": 6, "great": 0, "good": 0, "current_streak": 6, "max_streak": 6}} -{"type": "duration", "id": 6, "duration": "perfect", "info": {"max_score": 1000, "score": 600, "wrong": 0, "missed": 0, "perfect": 6, "great": 0, "good": 0, "current_streak": 6, "max_streak": 6}} -{"type": "timing", "id": 7, "timing": "perfect", "info": {"max_score": 1000, "score": 700, "wrong": 0, "missed": 0, "perfect": 7, "great": 0, "good": 0, "current_streak": 7, "max_streak": 7}} -{"type": "duration", "id": 7, "duration": "perfect", "info": {"max_score": 1000, "score": 700, "wrong": 0, "missed": 0, "perfect": 7, "great": 0, "good": 0, "current_streak": 7, "max_streak": 7}} -{"type": "timing", "id": 8, "timing": "perfect", "info": {"max_score": 1000, "score": 800, "wrong": 0, "missed": 0, "perfect": 8, "great": 0, "good": 0, "current_streak": 8, "max_streak": 8}} -{"type": "duration", "id": 8, "duration": "perfect", "info": {"max_score": 1000, "score": 800, "wrong": 0, "missed": 0, "perfect": 8, "great": 0, "good": 0, "current_streak": 8, "max_streak": 8}} -{"type": "timing", "id": 9, "timing": "perfect", "info": {"max_score": 1000, "score": 900, "wrong": 0, "missed": 0, "perfect": 9, "great": 0, "good": 0, "current_streak": 9, "max_streak": 9}} -{"type": "duration", "id": 9, "duration": "perfect", "info": {"max_score": 1000, "score": 900, "wrong": 0, "missed": 0, "perfect": 9, "great": 0, "good": 0, "current_streak": 9, "max_streak": 9}} -{"type": "timing", "id": 10, "timing": "perfect", "info": {"max_score": 1000, "score": 1000, "wrong": 0, "missed": 0, "perfect": 10, "great": 0, "good": 0, "current_streak": 10, "max_streak": 10}} -{"type": "duration", "id": 10, "duration": "perfect", "info": {"max_score": 1000, "score": 1000, "wrong": 0, "missed": 0, "perfect": 10, "great": 0, "good": 0, "current_streak": 10, "max_streak": 10}} +{"type": "timing", "id": 1, "timing": "perfect", "info": {"max_score": 1000, "score": 100, "wrong": 0, "missed": 0, "perfect": 1, "great": 0, "good": 0, "current_streak": 1, "max_streak": 1}, "game_id": "test"} +{"type": "duration", "id": 1, "duration": "perfect", "info": {"max_score": 1000, "score": 100, "wrong": 0, "missed": 0, "perfect": 1, "great": 0, "good": 0, "current_streak": 1, "max_streak": 1}, "game_id": "test"} +{"type": "timing", "id": 2, "timing": "perfect", "info": {"max_score": 1000, "score": 200, "wrong": 0, "missed": 0, "perfect": 2, "great": 0, "good": 0, "current_streak": 2, "max_streak": 2}, "game_id": "test"} +{"type": "duration", "id": 2, "duration": "perfect", "info": {"max_score": 1000, "score": 200, "wrong": 0, "missed": 0, "perfect": 2, "great": 0, "good": 0, "current_streak": 2, "max_streak": 2}, "game_id": "test"} +{"type": "timing", "id": 3, "timing": "perfect", "info": {"max_score": 1000, "score": 300, "wrong": 0, "missed": 0, "perfect": 3, "great": 0, "good": 0, "current_streak": 3, "max_streak": 3}, "game_id": "test"} +{"type": "duration", "id": 3, "duration": "perfect", "info": {"max_score": 1000, "score": 300, "wrong": 0, "missed": 0, "perfect": 3, "great": 0, "good": 0, "current_streak": 3, "max_streak": 3}, "game_id": "test"} +{"type": "timing", "id": 4, "timing": "perfect", "info": {"max_score": 1000, "score": 400, "wrong": 0, "missed": 0, "perfect": 4, "great": 0, "good": 0, "current_streak": 4, "max_streak": 4}, "game_id": "test"} +{"type": "duration", "id": 4, "duration": "perfect", "info": {"max_score": 1000, "score": 400, "wrong": 0, "missed": 0, "perfect": 4, "great": 0, "good": 0, "current_streak": 4, "max_streak": 4}, "game_id": "test"} +{"type": "timing", "id": 5, "timing": "perfect", "info": {"max_score": 1000, "score": 500, "wrong": 0, "missed": 0, "perfect": 5, "great": 0, "good": 0, "current_streak": 5, "max_streak": 5}, "game_id": "test"} +{"type": "duration", "id": 5, "duration": "perfect", "info": {"max_score": 1000, "score": 500, "wrong": 0, "missed": 0, "perfect": 5, "great": 0, "good": 0, "current_streak": 5, "max_streak": 5}, "game_id": "test"} +{"type": "timing", "id": 6, "timing": "perfect", "info": {"max_score": 1000, "score": 600, "wrong": 0, "missed": 0, "perfect": 6, "great": 0, "good": 0, "current_streak": 6, "max_streak": 6}, "game_id": "test"} +{"type": "duration", "id": 6, "duration": "perfect", "info": {"max_score": 1000, "score": 600, "wrong": 0, "missed": 0, "perfect": 6, "great": 0, "good": 0, "current_streak": 6, "max_streak": 6}, "game_id": "test"} +{"type": "timing", "id": 7, "timing": "perfect", "info": {"max_score": 1000, "score": 700, "wrong": 0, "missed": 0, "perfect": 7, "great": 0, "good": 0, "current_streak": 7, "max_streak": 7}, "game_id": "test"} +{"type": "duration", "id": 7, "duration": "perfect", "info": {"max_score": 1000, "score": 700, "wrong": 0, "missed": 0, "perfect": 7, "great": 0, "good": 0, "current_streak": 7, "max_streak": 7}, "game_id": "test"} +{"type": "timing", "id": 8, "timing": "perfect", "info": {"max_score": 1000, "score": 800, "wrong": 0, "missed": 0, "perfect": 8, "great": 0, "good": 0, "current_streak": 8, "max_streak": 8}, "game_id": "test"} +{"type": "duration", "id": 8, "duration": "perfect", "info": {"max_score": 1000, "score": 800, "wrong": 0, "missed": 0, "perfect": 8, "great": 0, "good": 0, "current_streak": 8, "max_streak": 8}, "game_id": "test"} +{"type": "timing", "id": 9, "timing": "perfect", "info": {"max_score": 1000, "score": 900, "wrong": 0, "missed": 0, "perfect": 9, "great": 0, "good": 0, "current_streak": 9, "max_streak": 9}, "game_id": "test"} +{"type": "duration", "id": 9, "duration": "perfect", "info": {"max_score": 1000, "score": 900, "wrong": 0, "missed": 0, "perfect": 9, "great": 0, "good": 0, "current_streak": 9, "max_streak": 9}, "game_id": "test"} +{"type": "timing", "id": 10, "timing": "perfect", "info": {"max_score": 1000, "score": 1000, "wrong": 0, "missed": 0, "perfect": 10, "great": 0, "good": 0, "current_streak": 10, "max_streak": 10}, "game_id": "test"} +{"type": "duration", "id": 10, "duration": "perfect", "info": {"max_score": 1000, "score": 1000, "wrong": 0, "missed": 0, "perfect": 10, "great": 0, "good": 0, "current_streak": 10, "max_streak": 10}, "game_id": "test"} {"type": "end", "overallScore": 1000, "precision": 100.0, "score": {"max_score": 1000, "score": 1000, "wrong": 0, "missed": 0, "perfect": 10, "great": 0, "good": 0, "current_streak": 10, "max_streak": 10}} diff --git a/scorometer/tests/random_miss/output b/scorometer/tests/random_miss/output index 1ba0cea..3e553c4 100644 --- a/scorometer/tests/random_miss/output +++ b/scorometer/tests/random_miss/output @@ -1,17 +1,17 @@ -{"type": "timing", "id": 1, "timing": "perfect", "info": {"max_score": 1000, "score": 100, "wrong": 0, "missed": 0, "perfect": 1, "great": 0, "good": 0, "current_streak": 1, "max_streak": 1}} -{"type": "duration", "id": 1, "duration": "perfect", "info": {"max_score": 1000, "score": 100, "wrong": 0, "missed": 0, "perfect": 1, "great": 0, "good": 0, "current_streak": 1, "max_streak": 1}} -{"type": "timing", "id": 3, "timing": "perfect", "info": {"max_score": 1000, "score": 200, "wrong": 0, "missed": 0, "perfect": 2, "great": 0, "good": 0, "current_streak": 2, "max_streak": 2}} -{"type": "duration", "id": 3, "duration": "perfect", "info": {"max_score": 1000, "score": 200, "wrong": 0, "missed": 0, "perfect": 2, "great": 0, "good": 0, "current_streak": 2, "max_streak": 2}} -{"type": "timing", "id": 4, "timing": "perfect", "info": {"max_score": 1000, "score": 300, "wrong": 0, "missed": 0, "perfect": 3, "great": 0, "good": 0, "current_streak": 3, "max_streak": 3}} -{"type": "duration", "id": 4, "duration": "perfect", "info": {"max_score": 1000, "score": 300, "wrong": 0, "missed": 0, "perfect": 3, "great": 0, "good": 0, "current_streak": 3, "max_streak": 3}} -{"type": "timing", "id": 5, "timing": "perfect", "info": {"max_score": 1000, "score": 400, "wrong": 0, "missed": 0, "perfect": 4, "great": 0, "good": 0, "current_streak": 4, "max_streak": 4}} -{"type": "duration", "id": 5, "duration": "perfect", "info": {"max_score": 1000, "score": 400, "wrong": 0, "missed": 0, "perfect": 4, "great": 0, "good": 0, "current_streak": 4, "max_streak": 4}} -{"type": "timing", "id": 6, "timing": "perfect", "info": {"max_score": 1000, "score": 500, "wrong": 0, "missed": 0, "perfect": 5, "great": 0, "good": 0, "current_streak": 5, "max_streak": 5}} -{"type": "duration", "id": 6, "duration": "perfect", "info": {"max_score": 1000, "score": 500, "wrong": 0, "missed": 0, "perfect": 5, "great": 0, "good": 0, "current_streak": 5, "max_streak": 5}} -{"type": "timing", "id": 8, "timing": "great", "info": {"max_score": 1000, "score": 575, "wrong": 0, "missed": 0, "perfect": 5, "great": 1, "good": 0, "current_streak": 6, "max_streak": 6}} -{"type": "duration", "id": 8, "duration": "too long", "info": {"max_score": 1000, "score": 575, "wrong": 0, "missed": 0, "perfect": 5, "great": 1, "good": 0, "current_streak": 6, "max_streak": 6}} -{"type": "timing", "id": 9, "timing": "perfect", "info": {"max_score": 1000, "score": 675, "wrong": 0, "missed": 0, "perfect": 6, "great": 1, "good": 0, "current_streak": 7, "max_streak": 7}} -{"type": "duration", "id": 9, "duration": "perfect", "info": {"max_score": 1000, "score": 675, "wrong": 0, "missed": 0, "perfect": 6, "great": 1, "good": 0, "current_streak": 7, "max_streak": 7}} -{"type": "timing", "id": 10, "timing": "perfect", "info": {"max_score": 1000, "score": 775, "wrong": 0, "missed": 0, "perfect": 7, "great": 1, "good": 0, "current_streak": 8, "max_streak": 8}} -{"type": "duration", "id": 10, "duration": "perfect", "info": {"max_score": 1000, "score": 775, "wrong": 0, "missed": 0, "perfect": 7, "great": 1, "good": 0, "current_streak": 8, "max_streak": 8}} +{"type": "timing", "id": 1, "timing": "perfect", "info": {"max_score": 1000, "score": 100, "wrong": 0, "missed": 0, "perfect": 1, "great": 0, "good": 0, "current_streak": 1, "max_streak": 1}, "game_id": "test"} +{"type": "duration", "id": 1, "duration": "perfect", "info": {"max_score": 1000, "score": 100, "wrong": 0, "missed": 0, "perfect": 1, "great": 0, "good": 0, "current_streak": 1, "max_streak": 1}, "game_id": "test"} +{"type": "timing", "id": 3, "timing": "perfect", "info": {"max_score": 1000, "score": 200, "wrong": 0, "missed": 0, "perfect": 2, "great": 0, "good": 0, "current_streak": 2, "max_streak": 2}, "game_id": "test"} +{"type": "duration", "id": 3, "duration": "perfect", "info": {"max_score": 1000, "score": 200, "wrong": 0, "missed": 0, "perfect": 2, "great": 0, "good": 0, "current_streak": 2, "max_streak": 2}, "game_id": "test"} +{"type": "timing", "id": 4, "timing": "perfect", "info": {"max_score": 1000, "score": 300, "wrong": 0, "missed": 0, "perfect": 3, "great": 0, "good": 0, "current_streak": 3, "max_streak": 3}, "game_id": "test"} +{"type": "duration", "id": 4, "duration": "perfect", "info": {"max_score": 1000, "score": 300, "wrong": 0, "missed": 0, "perfect": 3, "great": 0, "good": 0, "current_streak": 3, "max_streak": 3}, "game_id": "test"} +{"type": "timing", "id": 5, "timing": "perfect", "info": {"max_score": 1000, "score": 400, "wrong": 0, "missed": 0, "perfect": 4, "great": 0, "good": 0, "current_streak": 4, "max_streak": 4}, "game_id": "test"} +{"type": "duration", "id": 5, "duration": "perfect", "info": {"max_score": 1000, "score": 400, "wrong": 0, "missed": 0, "perfect": 4, "great": 0, "good": 0, "current_streak": 4, "max_streak": 4}, "game_id": "test"} +{"type": "timing", "id": 6, "timing": "perfect", "info": {"max_score": 1000, "score": 500, "wrong": 0, "missed": 0, "perfect": 5, "great": 0, "good": 0, "current_streak": 5, "max_streak": 5}, "game_id": "test"} +{"type": "duration", "id": 6, "duration": "perfect", "info": {"max_score": 1000, "score": 500, "wrong": 0, "missed": 0, "perfect": 5, "great": 0, "good": 0, "current_streak": 5, "max_streak": 5}, "game_id": "test"} +{"type": "timing", "id": 8, "timing": "great", "info": {"max_score": 1000, "score": 575, "wrong": 0, "missed": 0, "perfect": 5, "great": 1, "good": 0, "current_streak": 6, "max_streak": 6}, "game_id": "test"} +{"type": "duration", "id": 8, "duration": "too long", "info": {"max_score": 1000, "score": 575, "wrong": 0, "missed": 0, "perfect": 5, "great": 1, "good": 0, "current_streak": 6, "max_streak": 6}, "game_id": "test"} +{"type": "timing", "id": 9, "timing": "perfect", "info": {"max_score": 1000, "score": 675, "wrong": 0, "missed": 0, "perfect": 6, "great": 1, "good": 0, "current_streak": 7, "max_streak": 7}, "game_id": "test"} +{"type": "duration", "id": 9, "duration": "perfect", "info": {"max_score": 1000, "score": 675, "wrong": 0, "missed": 0, "perfect": 6, "great": 1, "good": 0, "current_streak": 7, "max_streak": 7}, "game_id": "test"} +{"type": "timing", "id": 10, "timing": "perfect", "info": {"max_score": 1000, "score": 775, "wrong": 0, "missed": 0, "perfect": 7, "great": 1, "good": 0, "current_streak": 8, "max_streak": 8}, "game_id": "test"} +{"type": "duration", "id": 10, "duration": "perfect", "info": {"max_score": 1000, "score": 775, "wrong": 0, "missed": 0, "perfect": 7, "great": 1, "good": 0, "current_streak": 8, "max_streak": 8}, "game_id": "test"} {"type": "end", "overallScore": 725, "precision": 80.0, "score": {"max_score": 1000, "score": 725, "wrong": 0, "missed": 2, "perfect": 7, "great": 1, "good": 0, "current_streak": 8, "max_streak": 8}} diff --git a/scorometer/tests/runner.sh b/scorometer/tests/runner.sh index ea39611..316ad07 100755 --- a/scorometer/tests/runner.sh +++ b/scorometer/tests/runner.sh @@ -10,7 +10,7 @@ TESTS_SUCCESS=0 TESTS_FAILED=0 function test { - cat $1/input | BACK_URL="http://localhost:3000" MUSICS_FOLDER="../../assets/musics/" python3 ../main.py 1> /tmp/scorometer_res 2> /tmp/scorometer_log + cat $1/input | BACK_URL="http://localhost:3000" MUSICS_FOLDER="../../assets/musics/" SCORO_TEST=true python3 ../main.py 1> /tmp/scorometer_res 2> /tmp/scorometer_log TESTS_DONE=$((TESTS_DONE + 1)) if [ -n "$SCOROMETER_AUTOFIX" ]; then cat /tmp/scorometer_res > $1/output @@ -36,7 +36,7 @@ then done exit $TESTS_FAILED else - cat $1/input | BACK_URL="http://localhost:3000" MUSICS_FOLDER="../../assets/musics/" python3 ../main.py 1> /tmp/scorometer_res 2> /tmp/scorometer_log + cat $1/input | SCORO_TEST=true BACK_URL="http://localhost:3000" MUSICS_FOLDER="../../assets/musics/" python3 ../main.py 1> /tmp/scorometer_res 2> /tmp/scorometer_log echo "=========== CURRENT OUTPUT ===========" cat /tmp/scorometer_res echo "======================================"