-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(blissfest) Add ticket info, slight rephrasing. Fix some discord rela…
…ted bugs
- Loading branch information
Showing
15 changed files
with
367 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
source .config.test | ||
source .config.dev |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,7 @@ | |
|
||
*.env.* | ||
*.config.(^sample) | ||
.config.dev | ||
config.yaml | ||
bloopyboi_dev | ||
bloopyboii_dev | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,62 @@ | ||
package providers | ||
|
||
import ( | ||
"fmt" | ||
"time" | ||
|
||
pkgmodels "github.com/h3mmy/bloopyboi/internal/models" | ||
"github.com/h3mmy/bloopyboi/bot/internal/config" | ||
"github.com/h3mmy/bloopyboi/bot/services" | ||
pkgmodels "github.com/h3mmy/bloopyboi/internal/models" | ||
"go.uber.org/zap" | ||
) | ||
|
||
const BlissfestStartDateKey = "start_date" | ||
const BlissfestHomepage = "https://www.blissfest.org/" | ||
|
||
// Blissfest is in MI and bound to the US Eastern Timezone | ||
// Since it always happens in the summer we can assume EDT | ||
var blissfestTZ = time.FixedZone("UTC-4", -4*60*60) | ||
var defaultBlissfestStartDate = time.Date(2024, 7, 12, 0, 0, 0, 0, blissfestTZ) | ||
|
||
func GetBlissfestService() *services.BlissfestService { | ||
location, _ := time.LoadLocation("America/Detroit") | ||
config := pkgmodels.BlissfestConfig{ | ||
Start: time.Date(2024, 7, 12, 9, 0, 0, 0, location), | ||
End: time.Date(2024, 7, 14, 9, 0, 0, 0, location), | ||
Homepage: "https://www.blissfest.org/", | ||
// Blissfest is in MI and bound to the US Eastern Timezone | ||
if IsFeatureEnabled(pkgmodels.BlissfestFeatureKey) { | ||
// check for provided start date | ||
cfg := GetFeatures()[pkgmodels.BlissfestFeatureKey] | ||
startDate := getBlissfestStartDate(cfg) | ||
|
||
year, month, day := startDate.Date() | ||
logger.Debug(fmt.Sprintf("startDate year: %d, month: %d, day: %d", year, month, day)) | ||
// blissfest always starts at 9am on a Friday | ||
finalStartDate := time.Date(year, month, day, 9, 0, 0, 0, blissfestTZ) | ||
logger.Debug("finalized blissfest start date", zap.Time("startDate", finalStartDate)) | ||
// everyone is supposed to be out by noon on the following Monday (3 days + 3 hours => 4500min => 75 hours) | ||
finalEndDate := finalStartDate.Add(75 * time.Hour) | ||
logger.Debug("finalized blissfest end date", zap.Time("endDate", finalEndDate)) | ||
return services.NewBlissfestService(pkgmodels.BlissfestConfig{ | ||
Start: finalStartDate, | ||
End: finalEndDate, | ||
Homepage: BlissfestHomepage, | ||
}) | ||
} | ||
logger.Warn("blissfest feature not enabled") | ||
|
||
return nil | ||
} | ||
|
||
func getBlissfestStartDate(cfg config.FeatureConfig) time.Time { | ||
if cfg.Data != nil { | ||
startDateString, ok := cfg.Data[BlissfestStartDateKey] | ||
if ok { | ||
logger.Debug("parsing start date", zap.String("providedDate", startDateString)) | ||
startDate, err := time.Parse("2006-01-02", startDateString) | ||
if err != nil { | ||
logger.Error("error parsing configured start date", zap.Error(err)) | ||
startDate = defaultBlissfestStartDate | ||
} | ||
logger.Debug("finished parsing start date", zap.String("providedDate", startDateString), zap.Time("startDate", startDate)) | ||
return startDate | ||
} | ||
} | ||
return services.NewBlissfestService(config) | ||
return defaultBlissfestStartDate | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
71d5a3c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Related to #35