Add a 24-hour reminder tweet for Splatfests

This commit is contained in:
Matt Isenhower
2018-09-07 15:17:54 -07:00
parent 25d711124e
commit e002322189
2 changed files with 17 additions and 2 deletions

View File

@@ -54,6 +54,11 @@ class SplatfestTweet extends TwitterPostBase {
festival = this.getFestivals(region).find(f => f.times.end == this.getDataTime());
if (festival)
return { festival, type: 'end' };
// Festival 24-hour reminder
festival = this.getFestivals(region).find(f => f.times.start == this.getDataTime() + 24 * 60 * 60);
if (festival)
return { festival, type: 'reminder' };
}
// Which regions have this Splatfest?
@@ -86,7 +91,7 @@ class SplatfestTweet extends TwitterPostBase {
}
getImage(data) {
return captureSplatfestScreenshot(this.region, data.festival.times[data.type], this.regions(data));
return captureSplatfestScreenshot(this.region, this.getDataTime(), this.regions(data));
}
getText(data) {
@@ -105,6 +110,11 @@ class SplatfestTweet extends TwitterPostBase {
return `The ${isGlobal ? 'global' : regionDemonyms} Splatfest is now open! #splatfest #splatoon2`;
return `The Splatfest is now open in ${this.regionInfo.name}! #splatfest #splatoon2`;
case 'reminder':
if (isSimultaneous)
return `Reminder: The ${isGlobal ? 'global' : regionDemonyms} Splatfest starts in just 24 hours! #splatfest #splatoon2`;
return `Reminder: The Splatfest starts in ${this.regionInfo.name} in just 24 hours! #splatfest #splatoon2`;
case 'end':
let hours = (data.festival.times.result - this.getDataTime()) / 60 / 60;
let duration = (hours == 1) ? '1 hour' : `${hours} hours`;

View File

@@ -53,7 +53,12 @@
</template>
<template v-else>
<template v-if="festival.state == 'upcoming'">
{{ festival.times.start - now | shortDuration | time.in }}
<template v-if="festival.times.start - now > 24 * 60 * 60">
{{ festival.times.start - now | shortDuration | time.in }}
</template>
<template v-else>
{{ festival.times.start - now | durationHours | time.in }}
</template>
</template>
<template v-else-if="festival.state == 'past' && !results && festival.times.result > now">
{{ festival.times.result - now | durationHours | resultsIn }}