Skip to content

Commit

Permalink
Merge pull request #145 from HackRU/feature/dayof-changes
Browse files Browse the repository at this point in the history
Day Of Changes
  • Loading branch information
sahej172002 authored Feb 10, 2021
2 parents 30e787c + acb664a commit 7b25cb0
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 10 deletions.
12 changes: 9 additions & 3 deletions src/client/apps/VisualizePrizesApp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,14 @@ function prizeTablesFromResponse(res: GetFullScoresResponseData): Array<PrizeTab
const prizeTables: Array<PrizeTable> = [];
for (let i=0;i<res.prizes.length;i++) {
const prize = res.prizes[i];
const statuses: Array<Array<{status: string}>> = res.judges.map(j => []);

const statuses: Array<Array<{status: string, score: string}>> = res.judges.map(j => []);
console.log(statuses);
for (let eligibleSubmissionIndex of prize.eligibleSubmissions) {
for (let j=0;j<res.judges.length;j++) {
const statusObj = {
status: "JSSTATUS_NONE"
status: "JSSTATUS_NONE",
score: ""
};

statuses[j].push(statusObj);
Expand All @@ -99,7 +102,10 @@ function prizeTablesFromResponse(res: GetFullScoresResponseData): Array<PrizeTab
for (let status of statuses) {
status.statusObj.status = ass.active ? "JSSTATUS_ACTIVE" : (
ass.noShow ? "JSSTATUS_NOSHOW" : "JSSTATUS_COMPLETE"
);

);
status.statusObj.score = ass.rating ? (ass.rating * 100) + "" : "0";

}
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/client/components/VisualizePrizesPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const VisualizePrizesPage = (props: VisualizePrizesPageProps) => (
key={li}
style={{background: colorFromStatus(pt.statuses[ji][li])}}
>
{' '}
{(() => { console.log(pt.statuses[ji][li]); return pt.statuses[ji][li].score; })()}
</td>
))}
</tr>
Expand Down Expand Up @@ -69,4 +69,5 @@ export interface PrizeTable {

export interface JudgeSubmissionStatus {
status: string;
score: string;
};
3 changes: 3 additions & 0 deletions src/server/GetRatingScoresRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ export class GetRatingScoresRequest implements RequestHandler {
const judges = this.db.prepare(
"SELECT id, name, anchor FROM Judge ORDER BY id;"
).all();

//const assignments = this.db.prepare("select Assignment.judgeId AS judgeId, Assignment.status AS status, RatingAssignment.submissionId as submissionId, sum(Rating.answer) as rating from RatingAssignment, Rating left join Assignment ON RatingAssignment.assignmentId=Assignment.id where RatingAssignment.assignmentId=Rating.answer group by RatingAssignment.assignmentId").all();

const assignments = this.db.prepare("select sum(Rating.answer) as rating, Assignment.judgeId as judgeId, RatingAssignment.submissionId as submissionId, Assignment.status as Status from RatingAssignment, Rating, Assignment where Rating.ratingAssignmentId = RatingAssignment.assignmentId and Rating.ratingAssignmentId = Assignment.id group by Assignment.judgeId, RatingAssignment.submissionId").all();
this.db.commit();

Expand Down
2 changes: 2 additions & 0 deletions tools/judgingtablescreator/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
config.json
create-tables.js
2 changes: 1 addition & 1 deletion tools/judgingtablescreator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ npm install
tsc create-tables.ts
```

3. Create a config.json file based on the provided example-config.json file. Add your slack bot OAuth token to your config file!
3. Create a config.json file based on the provided `config.json.example` file. Add your slack bot OAuth token to your config file!

You can find your token here:
![](readme/bot-oath-token.png?raw=true)
Expand Down
14 changes: 11 additions & 3 deletions tools/judgingtablescreator/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 7 additions & 2 deletions tools/judgingtablescreator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "Creates x number of channels in Slack as user wishes",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"compile": "tsc create-tables.ts"
},
"repository": {
"type": "git",
Expand All @@ -18,6 +18,11 @@
"homepage": "https://github.com/samuel-ping/slack-judge-table-creator#readme",
"dependencies": {
"@types/node": "^14.11.5",
"axios": "^0.21.1"

"axios": "^0.20.0"
},
"devDependencies": {
"tsc": "^1.20150623.0"

}
}

0 comments on commit 7b25cb0

Please sign in to comment.