Skip to content

Commit

Permalink
END_DATE_PRIORITY_WEIGHT_MULTIPLIER current day to 24 hour fix
Browse files Browse the repository at this point in the history
  • Loading branch information
dtcooper committed Aug 7, 2024
1 parent 74852d9 commit 1f05eec
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Changes for 2024 based on real world usage in 2023 and feedback
- [x] Asset alternates (single asset has 4-5 underlying audio files that are cycled through)
- [x] Backend done
- [x] A large clock in the UI
- [ ] Make weights for previous 24 hours... AND reflect that in front-end (day-of
- [x] Make weights for previous 24 hours... AND reflect that in front-end (day-of
pill) and back-end (sortable)... will require change to `END_DATE_PRIORITY_WEIGHT_MULTIPLIER`
- [x] Added day-of-event pill
- [x] Rudimentary stopset editor, in the form of "skip/queue", regenerate asset, and swap asset
Expand Down
3 changes: 1 addition & 2 deletions client/src/stores/db.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,7 @@ class Asset extends AssetStopsetHydratableObject {

const pickRandomItemByWeight = (objects, endDateMultiplier = null, startTime = null) => {
objects = objects.map((obj) => {
// Apply end date multiplier (if it exists)
if (endDateMultiplier && endDateMultiplier > 0 && obj.end && startTime && obj.end.isSame(startTime, "day")) {
if (endDateMultiplier && endDateMultiplier > 0 && obj.end && startTime && startTime.isSameOrAfter(obj.end.subtract(1, "day"))) {
return [obj, obj.weight * endDateMultiplier, true]
} else {
return [obj, obj.weight, false]
Expand Down
4 changes: 2 additions & 2 deletions server/tomato/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,8 +334,8 @@ def validate_reset_times(values):
"END_DATE_PRIORITY_WEIGHT_MULTIPLIER": (
Decimal(0),
mark_safe(
"Multiply an asset's weight by this number if it has an end date <strong>and</strong> the current date is"
" the end date. <strong>Set to 0 to disable</strong> this feature."
"Multiply an asset's weight by this number if it has an end date <strong>and</strong> the end date is"
" in the next 24 hours (one day). <strong>Set to 0 to disable</strong> this feature."
),
"asset_end_date_priority_weight_multiplier",
),
Expand Down

0 comments on commit 1f05eec

Please sign in to comment.