Skip to content

Commit 4b22b66

Browse files
authored
Merge pull request #14 from topcoder-platform/fix-submission-links-query
fix: submission links query
2 parents b3412a9 + 4bd281e commit 4b22b66

File tree

4 files changed

+38
-29
lines changed

4 files changed

+38
-29
lines changed

sql/reports/challenges/submission-links.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ LEFT JOIN
1818
LEFT JOIN
1919
resources."ResourceRole" rr on res."roleId" = rr.id
2020
LEFT JOIN
21-
resources."MemberProfile" mp on res."memberId" = mp."userId"::text
21+
members."member" mp on res."memberId" = mp."userId"::text
2222
LEFT JOIN
2323
reviews."submission" sub on sub."memberId"=res."memberId" AND sub."challengeId"=c.id
2424
WHERE rr.name = 'Submitter'

src/app-constants.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ export const Scopes = {
55
TopgearCancelledChallenge: "reports:topgear-cancelled-challenge",
66
AllReports: "reports:all",
77
TopgearChallengeTechnology: "reports:topgear-challenge-technology",
8-
TopgearChallengeRegistrantDetails: "reports:topgear-challenge-registrant-details",
8+
TopgearChallengeRegistrantDetails:
9+
"reports:topgear-challenge-registrant-details",
910
SFDC: {
1011
PaymentsReport: "reports:sfdc-payments",
1112
BA: "reports:sfdc-ba",

src/reports/challenges/challenges-reports.controller.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ import { Scopes as AppScopes } from "../../app-constants";
1313
import { ChallengesReportsService } from "./challenges-reports.service";
1414
import { ChallengeRegistrantsQueryDto } from "./dtos/registrants.dto";
1515
import { ChallengesReportQueryDto } from "./dtos/challenge.dto";
16-
import { SubmissionLinksDto, SubmissionLinksQueryDto } from "./dtos/submission-links.dto";
16+
import {
17+
SubmissionLinksDto,
18+
SubmissionLinksQueryDto,
19+
} from "./dtos/submission-links.dto";
1720

1821
@ApiTags("Challenges Reports")
1922
@Controller("/challenges")
Lines changed: 31 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
1-
import { ApiProperty } from '@nestjs/swagger';
2-
import { IsDateString, IsNotEmpty, IsOptional, IsString } from 'class-validator';
3-
import { ChallengeStatus } from './challenge-status.enum';
4-
import { Transform } from 'class-transformer';
5-
import { transformArray } from 'src/common/validation.util';
6-
1+
import { ApiProperty } from "@nestjs/swagger";
2+
import {
3+
IsDateString,
4+
IsNotEmpty,
5+
IsOptional,
6+
IsString,
7+
} from "class-validator";
8+
import { ChallengeStatus } from "./challenge-status.enum";
9+
import { Transform } from "class-transformer";
10+
import { transformArray } from "src/common/validation.util";
711

812
export class SubmissionLinksQueryDto {
9-
1013
@ApiProperty({
1114
required: true,
1215
description: "Filter by challenge completion date (from)",
@@ -24,17 +27,17 @@ export class SubmissionLinksQueryDto {
2427
@IsDateString()
2528
completionDateTo?: Date;
2629

27-
@ApiProperty({
28-
required: false,
29-
enum: ChallengeStatus,
30-
example: [ChallengeStatus.COMPLETED],
31-
isArray: true,
32-
})
33-
@IsOptional()
34-
@IsString({ each: true })
35-
@IsNotEmpty({ each: true })
36-
@Transform(transformArray)
37-
challengeStatus?: ChallengeStatus[];
30+
@ApiProperty({
31+
required: false,
32+
enum: ChallengeStatus,
33+
example: [ChallengeStatus.COMPLETED],
34+
isArray: true,
35+
})
36+
@IsOptional()
37+
@IsString({ each: true })
38+
@IsNotEmpty({ each: true })
39+
@Transform(transformArray)
40+
challengeStatus?: ChallengeStatus[];
3841
}
3942

4043
export class SubmissionLinksDto {
@@ -44,42 +47,44 @@ export class SubmissionLinksDto {
4447
challengeId: number;
4548

4649
@ApiProperty({
47-
description: "Status of the challenge"
50+
description: "Status of the challenge",
4851
})
4952
challengeStatus: ChallengeStatus;
5053

5154
@ApiProperty({
52-
description: "The date at which the challenge is completed"
55+
description: "The date at which the challenge is completed",
5356
})
5457
challengeCompletedDate: string | null;
5558

5659
@ApiProperty({
57-
description: "The registration handle of the submitter"
60+
description: "The registration handle of the submitter",
5861
})
5962
registrantHandle: string;
6063

6164
@ApiProperty({
62-
description: "The final score received by the registrant on that submission"
65+
description:
66+
"The final score received by the registrant on that submission",
6367
})
6468
registrantFinalScore: number;
6569

6670
@ApiProperty({
67-
description: "This denotes if the submission has passed. If the final score is greater than 98 then its considered pass"
71+
description:
72+
"This denotes if the submission has passed. If the final score is greater than 98 then its considered pass",
6873
})
6974
didSubmissionPass: boolean;
7075

7176
@ApiProperty({
72-
description: "The link to the submission url"
77+
description: "The link to the submission url",
7378
})
7479
submissionUrl: string;
7580

7681
@ApiProperty({
77-
description: "Submission ID"
82+
description: "Submission ID",
7883
})
7984
submissionId: number;
8085

8186
@ApiProperty({
82-
description: "Submission creation date"
87+
description: "Submission creation date",
8388
})
8489
submissionCreatedDate: string;
8590
}

0 commit comments

Comments
 (0)