Compare commits
	
		
			12 Commits
		
	
	
		
			23bd432c5f
			...
			v0.10.2
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 1d82f65b0d | |||
| 610988ec16 | |||
| 6e236ede14 | |||
| b7ad5d3a31 | |||
| a694ad225c | |||
| 5633e85f41 | |||
| 95e1eec313 | |||
| 377d5dadb2 | |||
| 4a294b1e17 | |||
| 720774fcf4 | |||
| dcdbdd15ac | |||
| 132b48cf2a | 
							
								
								
									
										11
									
								
								.drone.yml
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								.drone.yml
									
									
									
									
									
								
							| @@ -19,6 +19,13 @@ get: | |||||||
|   path: odit-git-bot |   path: odit-git-bot | ||||||
|   name: sshkey |   name: sshkey | ||||||
|  |  | ||||||
|  | --- | ||||||
|  | kind: secret | ||||||
|  | name: ci_token | ||||||
|  | get: | ||||||
|  |   path: odit-ci-bot | ||||||
|  |   name: apikey | ||||||
|  |  | ||||||
| --- | --- | ||||||
| kind: pipeline | kind: pipeline | ||||||
| type: kubernetes | type: kubernetes | ||||||
| @@ -176,13 +183,13 @@ steps: | |||||||
|     settings: |     settings: | ||||||
|       urls: https://ci.odit.services/api/repos/lfk/lfk-client-node/builds?SOURCE_TAG=${DRONE_TAG} |       urls: https://ci.odit.services/api/repos/lfk/lfk-client-node/builds?SOURCE_TAG=${DRONE_TAG} | ||||||
|       bearer: |       bearer: | ||||||
|         from_secret: BOT_DRONE_KEY |         from_secret: ci_token | ||||||
|   - name: trigger js lib build |   - name: trigger js lib build | ||||||
|     image: idcooldi/drone-webhook |     image: idcooldi/drone-webhook | ||||||
|     settings: |     settings: | ||||||
|       urls: https://ci.odit.services/api/repos/lfk/lfk-client-js/builds?SOURCE_TAG=${DRONE_TAG} |       urls: https://ci.odit.services/api/repos/lfk/lfk-client-js/builds?SOURCE_TAG=${DRONE_TAG} | ||||||
|       bearer: |       bearer: | ||||||
|         from_secret: BOT_DRONE_KEY |         from_secret: ci_token | ||||||
| trigger: | trigger: | ||||||
|   event: |   event: | ||||||
|   - tag |   - tag | ||||||
							
								
								
									
										42
									
								
								CHANGELOG.md
									
									
									
									
									
								
							
							
						
						
									
										42
									
								
								CHANGELOG.md
									
									
									
									
									
								
							| @@ -2,8 +2,50 @@ | |||||||
|  |  | ||||||
| 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.10.2](https://git.odit.services/lfk/backend/compare/v0.10.1...v0.10.2) | ||||||
|  |  | ||||||
|  | - Added first selfservice test [`057ae0d`](https://git.odit.services/lfk/backend/commit/057ae0d79758cd627d6d128406a0d201b6b7ad9b) | ||||||
|  | - 🧾New changelog file version [CI SKIP] [skip ci] [`b7ad5d3`](https://git.odit.services/lfk/backend/commit/b7ad5d3a31b8b4f5960852d3ac38af133719ebcd) | ||||||
|  | - First try of the laptime sort [`4471e57`](https://git.odit.services/lfk/backend/commit/4471e57438582d55ff846fd69c2cfcc26b40df2a) | ||||||
|  | - Potential fix for all remaining errors [`377d5da`](https://git.odit.services/lfk/backend/commit/377d5dadb2a14cb2d70e0b2dc77026f51b3fb51c) | ||||||
|  | - At least one fewer test should fail now [`87f444c`](https://git.odit.services/lfk/backend/commit/87f444c30d69d65a9f918c63631a859a389eeee3) | ||||||
|  | - Tried workaround for no availdable stats [`8f0f795`](https://git.odit.services/lfk/backend/commit/8f0f795a709db216396998b68b8bbd64ff4d44ff) | ||||||
|  | - Reverted temp bugfix [`4603a84`](https://git.odit.services/lfk/backend/commit/4603a84f16fb53a14d1792447100f5b470969dd0) | ||||||
|  | - Fixed sorting algo [`988f17a`](https://git.odit.services/lfk/backend/commit/988f17a795bb2d867e9d1d8e78051dff1a14ec30) | ||||||
|  | - Added runners stats tests [`7111068`](https://git.odit.services/lfk/backend/commit/7111068361e00cc1308664a3ae650a56e28c015c) | ||||||
|  | - Added basic laptime endpoint [`cb71fcd`](https://git.odit.services/lfk/backend/commit/cb71fcd13bc61e6214e2fd7b70e72094749463d3) | ||||||
|  | - Added orgs by donations stats tests [`d4a02e7`](https://git.odit.services/lfk/backend/commit/d4a02e7db2ff4976be21605e31aac2f3c82a49c0) | ||||||
|  | - Added teams stats endpoint tests [`b9a7dc8`](https://git.odit.services/lfk/backend/commit/b9a7dc84f05441445453193974b2a793b5197fa5) | ||||||
|  | - Now resolving all missing relations [`257f320`](https://git.odit.services/lfk/backend/commit/257f320ee3bf6429c4314c64023520366f9f730b) | ||||||
|  | - Added min laptime to StatsRunner [`51daf96`](https://git.odit.services/lfk/backend/commit/51daf969cf74792b2c2f2f16ce4359d9fca47bc8) | ||||||
|  | - Fixed sorting [`7b15c2d`](https://git.odit.services/lfk/backend/commit/7b15c2d88b14e7279aad97b0c950202ddb5acaaa) | ||||||
|  | - Fixed top-ten bein top 9 [`a6a526d`](https://git.odit.services/lfk/backend/commit/a6a526dc5d8b1613ea34e82e477081349e764aec) | ||||||
|  | - added new ci secret [`5633e85`](https://git.odit.services/lfk/backend/commit/5633e85f41cb69b10fd8a86f57f1bd2f50848f7b) | ||||||
|  | - Added temp console log for test [`22cae39`](https://git.odit.services/lfk/backend/commit/22cae39bd351ca285880e50187ea0d46a7a26437) | ||||||
|  | - Added temp console log for ci debugging [`4a73eab`](https://git.odit.services/lfk/backend/commit/4a73eab134c3a9f58771be996bc8811b62cf378e) | ||||||
|  | - Temp disabled runners by donations test [`0b07a53`](https://git.odit.services/lfk/backend/commit/0b07a53ed209c6193ead3c4d199545e22333ab32) | ||||||
|  | - Updated default docker-compose [`f8baca5`](https://git.odit.services/lfk/backend/commit/f8baca5ab2c56b906751bc7edd71477456ad91f3) | ||||||
|  | - Removed all useless console.logs [`95e1eec`](https://git.odit.services/lfk/backend/commit/95e1eec313a79458dd75307a9d0f8319af0d0904) | ||||||
|  | - Resolved missing parentgroup relation [`23bd432`](https://git.odit.services/lfk/backend/commit/23bd432c5f33a0863217120d97e2e4ea52a08baf) | ||||||
|  | - Removed console logs for now working tests [`71b33ab`](https://git.odit.services/lfk/backend/commit/71b33ab05b53b62c8b271bd2995c94b2fc212dfd) | ||||||
|  | - Fixed typo in test [`cbcb829`](https://git.odit.services/lfk/backend/commit/cbcb829fbde3a4a5e7f94de5dcf24d854c5fc257) | ||||||
|  | - Ptotential fix for stats failing [`dcdbdd1`](https://git.odit.services/lfk/backend/commit/dcdbdd15acfe6eef4220b7ed66db60d78107d1f9) | ||||||
|  | - 🚀Bumped version to v0.10.2 [`6e236ed`](https://git.odit.services/lfk/backend/commit/6e236ede145e164ee84543fb62404b4776550973) | ||||||
|  | - Merge pull request 'stats/runners/laptime feature/190-runners_laptime' (#191) from feature/190-runners_laptime into dev [`a694ad2`](https://git.odit.services/lfk/backend/commit/a694ad225c68fa23152402acba871c857433cc70) | ||||||
|  | - 🧾New changelog file version [CI SKIP] [skip ci] [`dd6d799`](https://git.odit.services/lfk/backend/commit/dd6d799c847fc96aec1be8f2667ad371890076fb) | ||||||
|  | - Pinned testing container tag to prod container tag [`10221b9`](https://git.odit.services/lfk/backend/commit/10221b9f2e4493080f3ff095d9772bcfd0ac50eb) | ||||||
|  | - Now resolving all relations for orgs by distance [`4a294b1`](https://git.odit.services/lfk/backend/commit/4a294b1e17c44294274b06748ec8141812c2d217) | ||||||
|  | - Added temp console log [`720774f`](https://git.odit.services/lfk/backend/commit/720774fcf47c38601ab88d5d74cfcd0e47b21acf) | ||||||
|  | - Removed console log for passing tests [`132b48c`](https://git.odit.services/lfk/backend/commit/132b48cf2a9e990a5e830c744ed8244bd25e8b3a) | ||||||
|  | - Removed console log [`1d8c8c8`](https://git.odit.services/lfk/backend/commit/1d8c8c8e9cefa58449f7abb2481d9396fe37ba20) | ||||||
|  | - Temp test logging workaround [`bf686e8`](https://git.odit.services/lfk/backend/commit/bf686e89e02998ccc80c838ef890c736c252634c) | ||||||
|  | - Temp test logging workaround [`6163f0a`](https://git.odit.services/lfk/backend/commit/6163f0a90b3721d3a1488f89cbb39ddff7152241) | ||||||
|  | - Removed test for content type [`63964fb`](https://git.odit.services/lfk/backend/commit/63964fbf2c41d9b90f995f056e9db65ab07d54a8) | ||||||
|  |  | ||||||
| #### [v0.10.1](https://git.odit.services/lfk/backend/compare/v0.10.0...v0.10.1) | #### [v0.10.1](https://git.odit.services/lfk/backend/compare/v0.10.0...v0.10.1) | ||||||
|  |  | ||||||
|  | > 3 April 2021 | ||||||
|  |  | ||||||
| - Merge pull request 'Release 0.10.1' (#189) from dev into main [`e89e07d`](https://git.odit.services/lfk/backend/commit/e89e07d0fc99f14148b01204fb8ed39e2da77e38) | - Merge pull request 'Release 0.10.1' (#189) from dev into main [`e89e07d`](https://git.odit.services/lfk/backend/commit/e89e07d0fc99f14148b01204fb8ed39e2da77e38) | ||||||
| - 🧾New changelog file version [CI SKIP] [skip ci] [`69afd4d`](https://git.odit.services/lfk/backend/commit/69afd4d5877401eb46df430f43a7feb273abda1e) | - 🧾New changelog file version [CI SKIP] [skip ci] [`69afd4d`](https://git.odit.services/lfk/backend/commit/69afd4d5877401eb46df430f43a7feb273abda1e) | ||||||
| - 🚀Bumped version to v0.10.1 [`24d152f`](https://git.odit.services/lfk/backend/commit/24d152fdc8fe17fffa2f2a718d7145ba8a91d79c) | - 🚀Bumped version to v0.10.1 [`24d152f`](https://git.odit.services/lfk/backend/commit/24d152fdc8fe17fffa2f2a718d7145ba8a91d79c) | ||||||
|   | |||||||
| @@ -1,6 +1,6 @@ | |||||||
| { | { | ||||||
|   "name": "@odit/lfk-backend", |   "name": "@odit/lfk-backend", | ||||||
|   "version": "0.10.1", |   "version": "0.10.2", | ||||||
|   "main": "src/app.ts", |   "main": "src/app.ts", | ||||||
|   "repository": "https://git.odit.services/lfk/backend", |   "repository": "https://git.odit.services/lfk/backend", | ||||||
|   "author": { |   "author": { | ||||||
|   | |||||||
| @@ -157,7 +157,7 @@ export class StatsController { | |||||||
|     @ResponseSchema(ResponseStatsOrgnisation, { isArray: true }) |     @ResponseSchema(ResponseStatsOrgnisation, { isArray: true }) | ||||||
|     @OpenAPI({ description: "Returns the top ten organizations by donations.", security: [{ "StatsApiToken": [] }, { "AuthToken": [] }, { "RefreshTokenCookie": [] }] }) |     @OpenAPI({ description: "Returns the top ten organizations by donations.", security: [{ "StatsApiToken": [] }, { "AuthToken": [] }, { "RefreshTokenCookie": [] }] }) | ||||||
|     async getTopOrgsByDonations() { |     async getTopOrgsByDonations() { | ||||||
|         let orgs = await getConnection().getRepository(RunnerOrganization).find({ relations: ['runners', 'runners.scans', 'runners.distanceDonations', 'runners.scans.track', 'teams', 'teams.runners', 'teams.runners.scans', 'teams.runners.distanceDonations', 'teams.runners.scans.track'] }); |         let orgs = await getConnection().getRepository(RunnerOrganization).find({ relations: ['runners', 'runners.distanceDonations', 'runners.distanceDonations.runner', 'runners.distanceDonations.runner.scans', 'runners.distanceDonations.runner.scans.track', 'teams', 'teams.runners', 'teams.runners.distanceDonations', 'teams.runners.distanceDonations.runner', 'teams.runners.distanceDonations.runner.scans', 'teams.runners.distanceDonations.runner.scans.track'] }); | ||||||
|         if (!orgs || orgs.length == 0) { |         if (!orgs || orgs.length == 0) { | ||||||
|             return []; |             return []; | ||||||
|         } |         } | ||||||
|   | |||||||
| @@ -51,6 +51,9 @@ export abstract class RunnerGroup { | |||||||
|   */ |   */ | ||||||
|   @IsInt() |   @IsInt() | ||||||
|   public get distance(): number { |   public get distance(): number { | ||||||
|  |     if (!this.runners || this.runners.length == 0) { | ||||||
|  |       return 0; | ||||||
|  |     } | ||||||
|     return this.runners.reduce((sum, current) => sum + current.distance, 0); |     return this.runners.reduce((sum, current) => sum + current.distance, 0); | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -49,7 +49,15 @@ export class ResponseStatsOrgnisation implements IResponse { | |||||||
|     public constructor(org: RunnerOrganization) { |     public constructor(org: RunnerOrganization) { | ||||||
|         this.name = org.name; |         this.name = org.name; | ||||||
|         this.id = org.id; |         this.id = org.id; | ||||||
|         this.distance = org.distance; |         try { | ||||||
|         this.donationAmount = org.distanceDonationAmount; |             this.distance = org.distance; | ||||||
|  |         } catch { | ||||||
|  |             this.distance = -1; | ||||||
|  |         } | ||||||
|  |         try { | ||||||
|  |             this.donationAmount = org.distanceDonationAmount; | ||||||
|  |         } catch { | ||||||
|  |             this.donationAmount = -1; | ||||||
|  |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -57,7 +57,15 @@ export class ResponseStatsTeam implements IResponse { | |||||||
|         this.name = team.name; |         this.name = team.name; | ||||||
|         this.id = team.id; |         this.id = team.id; | ||||||
|         this.parent = team.parentGroup.toResponse(); |         this.parent = team.parentGroup.toResponse(); | ||||||
|         this.distance = team.distance; |         try { | ||||||
|         this.donationAmount = team.distanceDonationAmount; |             this.distance = team.distance; | ||||||
|  |         } catch { | ||||||
|  |             this.distance = -1; | ||||||
|  |         } | ||||||
|  |         try { | ||||||
|  |             this.donationAmount = team.distanceDonationAmount; | ||||||
|  |         } catch { | ||||||
|  |             this.donationAmount = -1; | ||||||
|  |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -65,15 +65,11 @@ describe('GET /api/stats/runners/* should return 200', () => { | |||||||
| describe('GET /api/stats/teams/* should return 200', () => { | describe('GET /api/stats/teams/* should return 200', () => { | ||||||
|     it('get by distance w/ auth should return 200', async () => { |     it('get by distance w/ auth should return 200', async () => { | ||||||
|         const res = await axios.get(base + '/api/stats/teams/distance', axios_config_stats); |         const res = await axios.get(base + '/api/stats/teams/distance', axios_config_stats); | ||||||
|         console.log("################# Teams by distance #################"); |  | ||||||
|         console.log(res.data); |  | ||||||
|         expect(res.status).toEqual(200); |         expect(res.status).toEqual(200); | ||||||
|         expect(res.headers['content-type']).toContain("application/json"); |         expect(res.headers['content-type']).toContain("application/json"); | ||||||
|     }); |     }); | ||||||
|     it('get by donations w/ auth should return 200', async () => { |     it('get by donations w/ auth should return 200', async () => { | ||||||
|         const res = await axios.get(base + '/api/stats/teams/donations', axios_config_stats); |         const res = await axios.get(base + '/api/stats/teams/donations', axios_config_stats); | ||||||
|         console.log("################# Teams by donations #################"); |  | ||||||
|         console.log(res.data); |  | ||||||
|         expect(res.status).toEqual(200); |         expect(res.status).toEqual(200); | ||||||
|         expect(res.headers['content-type']).toContain("application/json"); |         expect(res.headers['content-type']).toContain("application/json"); | ||||||
|     }); |     }); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user