Compare commits
4 Commits
cc89ba8afb
...
9581185b24
Author | SHA1 | Date | |
---|---|---|---|
9581185b24 | |||
2905884c02 | |||
e9914e317b | |||
702070da66 |
@ -2,9 +2,18 @@
|
|||||||
|
|
||||||
All notable changes to this project will be documented in this file. Dates are displayed in UTC.
|
All notable changes to this project will be documented in this file. Dates are displayed in UTC.
|
||||||
|
|
||||||
|
#### [v0.15.1](https://git.odit.services/lfk/backend/compare/v0.15.0...v0.15.1)
|
||||||
|
|
||||||
|
- Faster trackscan creation by only loading the latest scan [`e9914e3`](https://git.odit.services/lfk/backend/commit/e9914e317b7fd78863cfd8549bad65da9292b7ca)
|
||||||
|
- Log batch time in mass scan script [`2905884`](https://git.odit.services/lfk/backend/commit/2905884c024d7f275b3ad2c2858a2f0911adb95b)
|
||||||
|
- Dont load cards with get all runners request [`702070d`](https://git.odit.services/lfk/backend/commit/702070da669cc605b93e6f5b62d712c28f079dd0)
|
||||||
|
|
||||||
#### [v0.15.0](https://git.odit.services/lfk/backend/compare/v0.14.6...v0.15.0)
|
#### [v0.15.0](https://git.odit.services/lfk/backend/compare/v0.14.6...v0.15.0)
|
||||||
|
|
||||||
|
> 15 April 2023
|
||||||
|
|
||||||
- Added test script for creating mass scans [`8007117`](https://git.odit.services/lfk/backend/commit/80071174342d87199fcbd981cd8c92300b0a51e4)
|
- Added test script for creating mass scans [`8007117`](https://git.odit.services/lfk/backend/commit/80071174342d87199fcbd981cd8c92300b0a51e4)
|
||||||
|
- 🚀Bumped version to v0.15.0 [`cc89ba8`](https://git.odit.services/lfk/backend/commit/cc89ba8afb3120569613a889baf962555612e95a)
|
||||||
- Get all scans speed improvement [`23fa78e`](https://git.odit.services/lfk/backend/commit/23fa78eb9dcc01ecc036347f6703aacc0d163d7d)
|
- Get all scans speed improvement [`23fa78e`](https://git.odit.services/lfk/backend/commit/23fa78eb9dcc01ecc036347f6703aacc0d163d7d)
|
||||||
- More scan request optimizations [`7c4ff42`](https://git.odit.services/lfk/backend/commit/7c4ff42a3b3e7b186e16c85a97d9ecc854a32cb0)
|
- More scan request optimizations [`7c4ff42`](https://git.odit.services/lfk/backend/commit/7c4ff42a3b3e7b186e16c85a97d9ecc854a32cb0)
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@odit/lfk-backend",
|
"name": "@odit/lfk-backend",
|
||||||
"version": "0.15.0",
|
"version": "0.15.1",
|
||||||
"main": "src/app.ts",
|
"main": "src/app.ts",
|
||||||
"repository": "https://git.odit.services/lfk/backend",
|
"repository": "https://git.odit.services/lfk/backend",
|
||||||
"engines": {
|
"engines": {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { Authorized, Body, Delete, Get, JsonController, OnUndefined, Param, Post, Put, QueryParam } from 'routing-controllers';
|
import { Authorized, Body, Delete, Get, JsonController, OnUndefined, Param, Post, Put, QueryParam } from 'routing-controllers';
|
||||||
import { OpenAPI, ResponseSchema } from 'routing-controllers-openapi';
|
import { OpenAPI, ResponseSchema } from 'routing-controllers-openapi';
|
||||||
import { getConnectionManager, Repository } from 'typeorm';
|
import { Repository, getConnectionManager } from 'typeorm';
|
||||||
import { RunnerGroupNeededError, RunnerHasDistanceDonationsError, RunnerIdsNotMatchingError, RunnerNotFoundError } from '../errors/RunnerErrors';
|
import { RunnerGroupNeededError, RunnerHasDistanceDonationsError, RunnerIdsNotMatchingError, RunnerNotFoundError } from '../errors/RunnerErrors';
|
||||||
import { RunnerGroupNotFoundError } from '../errors/RunnerGroupErrors';
|
import { RunnerGroupNotFoundError } from '../errors/RunnerGroupErrors';
|
||||||
import { CreateRunner } from '../models/actions/create/CreateRunner';
|
import { CreateRunner } from '../models/actions/create/CreateRunner';
|
||||||
@ -32,7 +32,7 @@ export class RunnerController {
|
|||||||
@OpenAPI({ description: 'Lists all runners from all teams/orgs. <br> This includes the runner\'s group and distance ran.' })
|
@OpenAPI({ description: 'Lists all runners from all teams/orgs. <br> This includes the runner\'s group and distance ran.' })
|
||||||
async getAll() {
|
async getAll() {
|
||||||
let responseRunners: ResponseRunner[] = new Array<ResponseRunner>();
|
let responseRunners: ResponseRunner[] = new Array<ResponseRunner>();
|
||||||
const runners = await this.runnerRepository.find({ relations: ['scans', 'group', 'group.parentGroup', 'scans.track', 'cards'] });
|
const runners = await this.runnerRepository.find({ relations: ['scans', 'group', 'group.parentGroup', 'scans.track'] });
|
||||||
runners.forEach(runner => {
|
runners.forEach(runner => {
|
||||||
responseRunners.push(new ResponseRunner(runner));
|
responseRunners.push(new ResponseRunner(runner));
|
||||||
});
|
});
|
||||||
|
@ -86,14 +86,13 @@ export class CreateTrackScan {
|
|||||||
* @returns The validated scan with it's laptime set.
|
* @returns The validated scan with it's laptime set.
|
||||||
*/
|
*/
|
||||||
public async validateScan(scan: TrackScan): Promise<TrackScan> {
|
public async validateScan(scan: TrackScan): Promise<TrackScan> {
|
||||||
const scans = await getConnection().getRepository(TrackScan).find({ where: { runner: scan.runner, valid: true }, relations: ["track"] });
|
const latestScan = await getConnection().getRepository(TrackScan).findOne({ where: { runner: scan.runner, valid: true }, relations: ["track"], order: { id: 'DESC' } });
|
||||||
if (scans.length == 0) {
|
if (!latestScan) {
|
||||||
scan.lapTime = 0;
|
scan.lapTime = 0;
|
||||||
scan.valid = true;
|
scan.valid = true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
const newestScan = scans[scans.length - 1];
|
scan.lapTime = scan.timestamp - latestScan.timestamp;
|
||||||
scan.lapTime = scan.timestamp - newestScan.timestamp;
|
|
||||||
scan.valid = (scan.lapTime > scan.track.minimumLapTime);
|
scan.valid = (scan.lapTime > scan.track.minimumLapTime);
|
||||||
}
|
}
|
||||||
return scan;
|
return scan;
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
|
console.time("batches")
|
||||||
for (let i = 0; i < 100; i++) {
|
for (let i = 0; i < 100; i++) {
|
||||||
const batch = [];
|
const batch = [];
|
||||||
for (let i = 0; i < 20; i++) {
|
for (let i = 0; i < 6; i++) {
|
||||||
batch.push(axios.post('http://localhost:4010/api/scans/trackscans', { card: 200000000001, station: 2 }, {
|
batch.push(axios.post('http://localhost:4010/api/scans/trackscans', { card: 200000000001, station: 2 }, {
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: 'Bearer 10F2E64.BB4F6CC5-2148-4CCF-88B5-0AA85D0508A9'
|
Authorization: 'Bearer 10F2E64.BB4F6CC5-2148-4CCF-88B5-0AA85D0508A9'
|
||||||
@ -11,7 +12,8 @@ async function main() {
|
|||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
await Promise.all(batch)
|
await Promise.all(batch)
|
||||||
console.log(`Finished batch ${i}`)
|
console.timeLog("batches", `Finished batch ${i}`)
|
||||||
}
|
}
|
||||||
|
console.timeEnd("batches")
|
||||||
}
|
}
|
||||||
main();
|
main();
|
Loading…
x
Reference in New Issue
Block a user