Add link to Lyle's schedule sheet and make week 20 & 21 2-week postseason matchups
This commit is contained in:
parent
16ca772f01
commit
b7e78aa8bc
@ -74,7 +74,12 @@
|
|||||||
<div class="col-sm-5">
|
<div class="col-sm-5">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div>
|
<div>
|
||||||
<h2>Season Schedule</h2>
|
<h2>Season Schedule
|
||||||
|
<a v-if="isAuthenticated && sheetsUrl" target="_blank" :href="sheetsUrl"
|
||||||
|
title="Master Schedule per Lyle">
|
||||||
|
🡵
|
||||||
|
</a>
|
||||||
|
</h2>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
@ -117,6 +122,7 @@ import { CHRISTMAS, CURRENT_SEASON, SEASON_START_DATE, THANKSGIVING } from '@/se
|
|||||||
import { fetchGamesBySeasonAndWeek } from '@/services/gameService'
|
import { fetchGamesBySeasonAndWeek } from '@/services/gameService'
|
||||||
import dayjs from 'dayjs'
|
import dayjs from 'dayjs'
|
||||||
import customParseFormat from 'dayjs/plugin/customParseFormat'
|
import customParseFormat from 'dayjs/plugin/customParseFormat'
|
||||||
|
import { isDiscordAuthenticated } from '@/services/authenticationService'
|
||||||
dayjs.extend(customParseFormat)
|
dayjs.extend(customParseFormat)
|
||||||
|
|
||||||
interface ScheduleWeekRow {
|
interface ScheduleWeekRow {
|
||||||
@ -130,6 +136,8 @@ export default {
|
|||||||
name: 'ScheduleView',
|
name: 'ScheduleView',
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
isAuthenticated: false as boolean,
|
||||||
|
sheetsUrl: 'https://docs.google.com/spreadsheets/d/1uYkbp3QWoBwBQHhgeW5EWfYF-_E7nKNmzrVbq084ZtQ/edit?usp=sharing',
|
||||||
currentWeekNumber: 0,
|
currentWeekNumber: 0,
|
||||||
weekGames: [] as Game[]
|
weekGames: [] as Game[]
|
||||||
}
|
}
|
||||||
@ -168,7 +176,7 @@ export default {
|
|||||||
|
|
||||||
for (let week = 1; week <= 21; week++) {
|
for (let week = 1; week <= 21; week++) {
|
||||||
const weekStartDate = currentWeekStartDate
|
const weekStartDate = currentWeekStartDate
|
||||||
const weekEndDate = this.isLongSeries(weekStartDate)
|
const weekEndDate = this.isLongSeries(weekStartDate, week)
|
||||||
? currentWeekStartDate.add(13, 'd')
|
? currentWeekStartDate.add(13, 'd')
|
||||||
: currentWeekStartDate.add(6, 'd')
|
: currentWeekStartDate.add(6, 'd')
|
||||||
|
|
||||||
@ -199,14 +207,19 @@ export default {
|
|||||||
async fetchCurrentWeekNumber(): Promise<void> {
|
async fetchCurrentWeekNumber(): Promise<void> {
|
||||||
const leagueInfo: LeagueInfo = await fetchCurrentLeagueInfo()
|
const leagueInfo: LeagueInfo = await fetchCurrentLeagueInfo()
|
||||||
this.currentWeekNumber = leagueInfo.week
|
this.currentWeekNumber = leagueInfo.week
|
||||||
|
|
||||||
|
this.isAuthenticated = await isDiscordAuthenticated()
|
||||||
},
|
},
|
||||||
async fetchData(): Promise<void> {
|
async fetchData(): Promise<void> {
|
||||||
this.weekGames = await fetchGamesBySeasonAndWeek(this.seasonNumber, this.selectedWeekNumber)
|
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
|
// current 18-week schedule has 2 week series for any game week that falls
|
||||||
// on the week of Thanksgiving or Christmas
|
// on the week of Thanksgiving or Christmas, and we are back to 2 weeks for
|
||||||
return Math.abs(weekStartDate.diff(THANKSGIVING, 'days')) < 6
|
// 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
|
|| Math.abs(weekStartDate.diff(CHRISTMAS, 'days')) < 6
|
||||||
},
|
},
|
||||||
weekSpecialInfo(weekNumber: number): string {
|
weekSpecialInfo(weekNumber: number): string {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user