From 85cbe68821163bd946553dee0d22b367b4feba1f Mon Sep 17 00:00:00 2001 From: Vereecken Date: Mon, 22 Jan 2024 08:37:27 +0100 Subject: [PATCH] Get competitions api: sort by date, startDate = two weeks ago, add per_page param --- README.md | 4 +--- src/common/api.ts | 10 ++++------ src/environments/environment.prod.ts | 2 +- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 4f23340..8889f14 100644 --- a/README.md +++ b/README.md @@ -5,11 +5,9 @@ Hosted at: https://goosly.github.io/AGE/ # Development To run locally: -1) > ng serve +1) > npm run start 2) Navigate to http://localhost:4200/ To build & deploy to GitHub Pages, simply run the bash script: 1) > sh build-prod.sh - -This builds the app and pushes the 'dist' directory to a branch called 'gh-pages', which will trigger a build by GitHub Pages diff --git a/src/common/api.ts b/src/common/api.ts index 2234dee..0dedbfe 100644 --- a/src/common/api.ts +++ b/src/common/api.ts @@ -13,7 +13,7 @@ import {ZottegemWcif} from '../test/zottegem'; }) export class ApiService { - private readonly FOUR_WEEKS = 28; + private readonly TWO_WEEKS = 14; public oauthToken; private headerParams: HttpHeaders; @@ -62,11 +62,9 @@ export class ApiService { getCompetitions(): Observable { let url = `${environment.wcaUrl}/api/v0/competitions?managed_by_me=true`; - if (!environment.testMode) { - const startDate = new Date(); - startDate.setDate(startDate.getDate() - this.FOUR_WEEKS); - url += `&start=${startDate.toISOString()}`; - } + const startDate = new Date(); + startDate.setDate(startDate.getDate() - this.TWO_WEEKS); + url += `&start=${startDate.toISOString()}&sort=start_date&per_page=1000`; return this.httpClient.get(url, {headers: this.headerParams}); } diff --git a/src/environments/environment.prod.ts b/src/environments/environment.prod.ts index 3f28a86..538ccda 100644 --- a/src/environments/environment.prod.ts +++ b/src/environments/environment.prod.ts @@ -7,7 +7,7 @@ export const environment = { wcaAppId : 'd9db39d5fd0195bcdc212ead360c748592cd1fd1409b040dd790281da91ef10d', wcaSecret : '305623ae24dd7c0789e811e7ae8b364f19e9109c976c0e5ba1c8add1a1773159', - version: '1.2.016', + version: '1.2.017', testMode: false, offlineMode: false };