Skip to content

Commit 160eebf

Browse files
committed
Fix up challenge tech report ad add in rux placements
1 parent 83852d0 commit 160eebf

File tree

4 files changed

+44
-3
lines changed

4 files changed

+44
-3
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
WITH member_placements AS (
2+
SELECT
3+
m."userId" AS member_id,
4+
m.handle AS handle,
5+
COUNT(DISTINCT s."challengeId")::int AS placements_count
6+
FROM reviews.submission s
7+
JOIN challenges."Challenge" c
8+
ON c.id = s."challengeId"
9+
JOIN challenges."ChallengeTrack" tr
10+
ON tr.id = c."trackId"
11+
JOIN members.member m
12+
ON m."userId"::text = s."memberId"::text
13+
WHERE s.placement IS NOT NULL
14+
AND s.placement > 0
15+
AND tr.abbreviation = 'DS'
16+
AND (
17+
c.name ILIKE 'RUX%'
18+
OR c.name ILIKE 'TCO RUX%'
19+
)
20+
GROUP BY m."userId", m.handle
21+
)
22+
SELECT
23+
member_id,
24+
handle,
25+
NULL::int AS max_rating,
26+
placements_count,
27+
placements_count AS count,
28+
RANK() OVER (ORDER BY placements_count DESC, handle ASC) AS rank
29+
FROM member_placements
30+
ORDER BY placements_count DESC, handle ASC;

sql/reports/statistics/development/challenges-technology.sql

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ WITH skill_counts AS (
88
JOIN skills.skill s
99
ON s.id = ws.skill_id
1010
JOIN challenges."Challenge" c
11-
ON c.id = ws.work_id
11+
ON c.id::text = ws.work_id::text
1212
JOIN challenges."ChallengeTrack" tr
1313
ON tr.id = c."trackId"
1414
LEFT JOIN challenges."ChallengeType" ct
1515
ON ct.id = c."typeId"
1616
WHERE st.name = 'challenge'
17-
AND tr.abbreviation = 'DE'
17+
AND tr.abbreviation = 'Dev'
1818
AND s.name IS NOT NULL
1919
AND s.deleted_at IS NULL
2020
AND COALESCE(ct."isTask", false) = false
@@ -34,4 +34,4 @@ SELECT
3434
DENSE_RANK() OVER (ORDER BY challenge_count DESC, skill_name ASC)::int AS rank
3535
FROM skill_counts
3636
ORDER BY "challenge_stats.count" DESC, "challenge_technology.name" ASC
37-
LIMIT 500;
37+
LIMIT 100;

src/statistics/design-statistics.service.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,9 @@ export class DesignStatisticsService {
6363
const q = this.sql.load("reports/statistics/design/lux-placements.sql");
6464
return this.db.query(q);
6565
}
66+
67+
async getRuxPlacements() {
68+
const q = this.sql.load("reports/statistics/design/rux-placements.sql");
69+
return this.db.query(q);
70+
}
6671
}

src/statistics/statistics-design.controller.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ export class StatisticsDesignController {
3131
return this.design.getLuxPlacements();
3232
}
3333

34+
@Get("/rux-placements")
35+
@ApiOperation({ summary: "Design RUX placements by member (desc)" })
36+
getRuxPlacements() {
37+
return this.design.getRuxPlacements();
38+
}
39+
3440
@Get("/first-time-submitters")
3541
@ApiOperation({ summary: "First-time design submitters in last 3 months" })
3642
getFirstTimeDesignSubmitters() {

0 commit comments

Comments
 (0)