Skip to content

Commit

Permalink
Get competitions api: sort by date, startDate = two weeks ago, add pe…
Browse files Browse the repository at this point in the history
…r_page param
  • Loading branch information
Goosly committed Jan 22, 2024
1 parent af7134e commit 85cbe68
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
10 changes: 4 additions & 6 deletions src/common/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -62,11 +62,9 @@ export class ApiService {

getCompetitions(): Observable<any> {
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});
}

Expand Down
2 changes: 1 addition & 1 deletion src/environments/environment.prod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const environment = {
wcaAppId : 'd9db39d5fd0195bcdc212ead360c748592cd1fd1409b040dd790281da91ef10d',
wcaSecret : '305623ae24dd7c0789e811e7ae8b364f19e9109c976c0e5ba1c8add1a1773159',

version: '1.2.016',
version: '1.2.017',
testMode: false,
offlineMode: false
};

0 comments on commit 85cbe68

Please sign in to comment.