From b7e78aa8bc6f29a935af232c19f01ccf9a75784e Mon Sep 17 00:00:00 2001 From: Peter Date: Mon, 18 Nov 2024 08:33:52 -0600 Subject: [PATCH] Add link to Lyle's schedule sheet and make week 20 & 21 2-week postseason matchups --- src/views/ScheduleView.vue | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/src/views/ScheduleView.vue b/src/views/ScheduleView.vue index c153b36..eba3a5c 100644 --- a/src/views/ScheduleView.vue +++ b/src/views/ScheduleView.vue @@ -74,7 +74,12 @@
-

Season Schedule

+

Season Schedule + + 🡵 + +

@@ -117,6 +122,7 @@ import { CHRISTMAS, CURRENT_SEASON, SEASON_START_DATE, THANKSGIVING } from '@/se import { fetchGamesBySeasonAndWeek } from '@/services/gameService' import dayjs from 'dayjs' import customParseFormat from 'dayjs/plugin/customParseFormat' +import { isDiscordAuthenticated } from '@/services/authenticationService' dayjs.extend(customParseFormat) interface ScheduleWeekRow { @@ -130,6 +136,8 @@ export default { name: 'ScheduleView', data() { return { + isAuthenticated: false as boolean, + sheetsUrl: 'https://docs.google.com/spreadsheets/d/1uYkbp3QWoBwBQHhgeW5EWfYF-_E7nKNmzrVbq084ZtQ/edit?usp=sharing', currentWeekNumber: 0, weekGames: [] as Game[] } @@ -168,7 +176,7 @@ export default { for (let week = 1; week <= 21; week++) { const weekStartDate = currentWeekStartDate - const weekEndDate = this.isLongSeries(weekStartDate) + const weekEndDate = this.isLongSeries(weekStartDate, week) ? currentWeekStartDate.add(13, 'd') : currentWeekStartDate.add(6, 'd') @@ -199,14 +207,19 @@ export default { async fetchCurrentWeekNumber(): Promise { const leagueInfo: LeagueInfo = await fetchCurrentLeagueInfo() this.currentWeekNumber = leagueInfo.week + + this.isAuthenticated = await isDiscordAuthenticated() }, async fetchData(): Promise { this.weekGames = await fetchGamesBySeasonAndWeek(this.seasonNumber, this.selectedWeekNumber) }, - isLongSeries(weekStartDate: dayjs.Dayjs): boolean { + isLongSeries(weekStartDate: dayjs.Dayjs, week: number): boolean { // current 18-week schedule has 2 week series for any game week that falls - // on the week of Thanksgiving or Christmas - return Math.abs(weekStartDate.diff(THANKSGIVING, 'days')) < 6 + // on the week of Thanksgiving or Christmas, and we are back to 2 weeks for + // LCS and WS in the postseason as well + return week === 20 + || week === 21 + || Math.abs(weekStartDate.diff(THANKSGIVING, 'days')) < 6 || Math.abs(weekStartDate.diff(CHRISTMAS, 'days')) < 6 }, weekSpecialInfo(weekNumber: number): string {