Skip to content

Commit

Permalink
Add end time to teamcowboy and shirt colour (#39)
Browse files Browse the repository at this point in the history
* Added end time to teamcowboy and shirt colour

* Add colour to spellcheck because i'm canadian

---------

Co-authored-by: Shawn Collinge <[email protected]>
  • Loading branch information
ShawnCollinge and ShawnCollinge authored Jun 19, 2023
1 parent 1bf1fb2 commit a3a33dc
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
3 changes: 2 additions & 1 deletion cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"Smartsheet",
"VMFH",
"Mountlake",
"Lynnwood"
"Lynnwood",
"Colour",
]
}
6 changes: 3 additions & 3 deletions src/transformers/DBLGameToCSV.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ function DBLGameToCSVRow(game: DBLGame): string {
game.Type,
game.Date,
game.Time,
"",
"",
game.endDate,
game.endTime,
"US/Pacific",
game.HomeOrAway,
game.Title || "",
game.rinkName,
"",
game.jerseyColour,
"",
"Yes",
"Yes",
Expand Down
5 changes: 5 additions & 0 deletions src/transformers/DBLGameToTeamCowboyGame.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,20 @@ import { DBLGame } from "../../typings/dblAppData";
import moment from "moment";

const BENCH_APP_DATE_FORMAT_STRING = "YYYY-MM-DD";
const END_TIME_FORMAT = "hh:mm:SS A";

export function DBLGameToTeamCowboyGame(snokingGame: SnokingGame, teamId: string): DBLGame {
const isHome = teamId == `${snokingGame.teamHomeSeasonId}`;
const endTime = moment(snokingGame.dateTime).add(90, "minutes");
return {
Type: "GAME",
Date: moment(snokingGame.dateTime).format(BENCH_APP_DATE_FORMAT_STRING),
Time: snokingGame.time,
Title: isHome ? snokingGame.teamAwayName : snokingGame.teamHomeName,
HomeOrAway: isHome ? "Home" : "Away",
rinkName: snokingGame.rinkName,
jerseyColour: isHome ? "White" : "Black",
endDate: moment(endTime).format(BENCH_APP_DATE_FORMAT_STRING),
endTime: moment(endTime).format(END_TIME_FORMAT),
};
}
4 changes: 3 additions & 1 deletion typings/dblAppData.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ export interface DBLGame {
* If your team is home or away
*/
HomeOrAway: "Home" | "Away";

jerseyColour: "White" | "Black";
endDate: string;
endTime: string;
rinkName: string;
}

0 comments on commit a3a33dc

Please sign in to comment.