From e0fa58da57013a3482636a04d20095d2f842fa7e Mon Sep 17 00:00:00 2001 From: Nicolai Ort Date: Wed, 30 Dec 2020 17:27:24 +0100 Subject: [PATCH] Added some comments ref #56 --- src/models/responses/ResponseStats.ts | 13 +++++++++++-- src/models/responses/ResponseStatsOrganisation.ts | 4 ++-- src/models/responses/ResponseStatsRunner.ts | 4 ++-- src/models/responses/ResponseStatsTeam.ts | 4 ++-- 4 files changed, 17 insertions(+), 8 deletions(-) diff --git a/src/models/responses/ResponseStats.ts b/src/models/responses/ResponseStats.ts index d236bd0..a691306 100644 --- a/src/models/responses/ResponseStats.ts +++ b/src/models/responses/ResponseStats.ts @@ -44,7 +44,7 @@ export class ResponseStats { total_scans: number; /** - * The total distance that all runners ran. + * The total distance that all runners ran combined. */ @IsInt() total_distance: number; @@ -56,11 +56,20 @@ export class ResponseStats { total_donation: number; /** - * The average distance per runner. + * The average distance ran per runner. */ @IsInt() average_distance: number; + /** + * Creates a new stats response containing some basic statistics for a dashboard or public display. + * @param runners Array containing all runners - the following relations have to be resolved: scans, scans.track + * @param teams Array containing all teams - no relations have to be resolved. + * @param orgs Array containing all orgs - no relations have to be resolved. + * @param users Array containing all users - no relations have to be resolved. + * @param scans Array containing all scans - no relations have to be resolved. + * @param donations Array containing all donations - the following relations have to be resolved: runner, runner.scans, runner.scans.track + */ public constructor(runners: Runner[], teams: RunnerTeam[], orgs: RunnerOrganisation[], users: User[], scans: Scan[], donations: Donation[]) { this.total_runners = runners.length; this.total_teams = teams.length; diff --git a/src/models/responses/ResponseStatsOrganisation.ts b/src/models/responses/ResponseStatsOrganisation.ts index 2fa6ae4..338a8b3 100644 --- a/src/models/responses/ResponseStatsOrganisation.ts +++ b/src/models/responses/ResponseStatsOrganisation.ts @@ -35,8 +35,8 @@ export class ResponseStatsOrgnisation { donationAmount: number; /** - * Creates a ResponseRunner object from a runner. - * @param runner The user the response shall be build for. + * Creates a new organisation stats response from a organisation + * @param org The organisation whoes response shall be generated - the following relations have to be resolved: runners, runners.scans, runners.distanceDonations, runners.scans.track, teams, teams.runners, teams.runners.scans, teams.runners.distanceDonations, teams.runners.scans.track */ public constructor(org: RunnerOrganisation) { this.name = org.name; diff --git a/src/models/responses/ResponseStatsRunner.ts b/src/models/responses/ResponseStatsRunner.ts index a219264..8b55983 100644 --- a/src/models/responses/ResponseStatsRunner.ts +++ b/src/models/responses/ResponseStatsRunner.ts @@ -54,8 +54,8 @@ export class ResponseStatsRunner { group: RunnerGroup; /** - * Creates a ResponseRunner object from a runner. - * @param runner The user the response shall be build for. + * Creates a new runner stats response from a runner + * @param runner The runner whoes response shall be generated - the following relations have to be resolved: scans, group, distanceDonations, scans.track */ public constructor(runner: Runner) { this.id = runner.id; diff --git a/src/models/responses/ResponseStatsTeam.ts b/src/models/responses/ResponseStatsTeam.ts index df48362..362971a 100644 --- a/src/models/responses/ResponseStatsTeam.ts +++ b/src/models/responses/ResponseStatsTeam.ts @@ -42,8 +42,8 @@ export class ResponseStatsTeam { parent: RunnerGroup; /** - * Creates a ResponseRunner object from a runner. - * @param runner The user the response shall be build for. + * Creates a new team stats response from a team + * @param team The team whoes response shall be generated - the following relations have to be resolved: runners, runners.scans, runners.distanceDonations, runners.scans.track */ public constructor(team: RunnerTeam) { this.name = team.name;