From d11c3f3795b077e01baf4763e8220c20b91e04e7 Mon Sep 17 00:00:00 2001 From: Matt Isenhower Date: Mon, 27 Feb 2023 19:03:43 -0800 Subject: [PATCH] Tweak the post content for upcoming Salmon Run shifts --- app/social/generators/SalmonRunUpcomingStatus.mjs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/social/generators/SalmonRunUpcomingStatus.mjs b/app/social/generators/SalmonRunUpcomingStatus.mjs index 4dd3dcb..1038ced 100644 --- a/app/social/generators/SalmonRunUpcomingStatus.mjs +++ b/app/social/generators/SalmonRunUpcomingStatus.mjs @@ -28,13 +28,15 @@ export default class SalmonRunUpcomingStatus extends StatusGenerator } _getDescription(schedule) { + let stageName = schedule.settings.coopStage.name || '???'; + switch (true) { case schedule.isBigRun: - return `A BIG RUN shift on ${schedule.settings.coopStage.name} has been added to the schedule! #salmonrun #splatoon3`; + return `A BIG RUN shift on ${stageName} has been added to the schedule! #salmonrun #splatoon3`; case schedule.isGrizzcoMystery: - return `A Salmon Run shift with GRIZZCO MYSTERY WEAPONS on ${schedule.settings.coopStage.name} has been added to the schedule! #salmonrun #splatoon3`; + return `A Salmon Run shift with GRIZZCO MYSTERY WEAPONS on ${stageName} has been added to the schedule! #salmonrun #splatoon3`; case schedule.isMystery: - return `A Salmon Run shift with MYSTERY WEAPONS on ${schedule.settings.coopStage.name} has been added to the schedule! #salmonrun #splatoon3`; + return `A Salmon Run shift with MYSTERY WEAPONS on ${stageName} has been added to the schedule! #salmonrun #splatoon3`; } } @@ -56,7 +58,7 @@ export default class SalmonRunUpcomingStatus extends StatusGenerator let formattedTime; if (hours >= 24) { - let days = Math.floor(hours / 24); + let days = Math.round(hours / 24); formattedTime = days === 1 ? '1 day' : `${days} days`; } else { formattedTime = hours === 1 ? '1 hour' : `${hours} hours`;