Skip to content

Rules can play chosen adverts from the Adverts list - #41

Merged
epell-development merged 1 commit into
mainfrom
claude/project-thread-4cp8t3
Nov 1, 2026
Merged

epell-development merged 1 commit into
mainfrom
claude/project-thread-4cp8t3

Conversation

@epell-development

Copy link
Copy Markdown
Owner

Requested by epell · project thread

Closes #38

What changes

  • Rule editor → What plays: when "the Adverts list" is chosen there are two options, "every advert" (what rules did before) and "only the adverts I tick". The second shows every advert in the list with a tick box (several can be ticked), its status (running today / not today / off / no audio file), and Tick all / Untick all. Switching to "only the adverts I tick" starts with all of them ticked. If nothing is ticked, the rule warns that it plays nothing. The rule summary says "from N chosen adverts".
  • Adverts list: each advert has a new advertiser / company field, shown as "Advertiser — Name" in the rule picker, and a line saying which rules play it.
  • Adverts get a stable id so rules keep the right adverts when the list is edited or reordered. Adverts saved by older versions get ids when the settings load (and in the Ads tool, for settings that come from an older server). Deleting an advert takes it out of the rules that chose it.
  • Playout: rule_pool only takes the chosen adverts. "Taking turns" goes through them in Adverts list order.

Compatibility

Existing rules have ad_choose = false, so they keep playing every advert in the list. When connected to a server, the new fields travel with the ads / ad_rules settings the Ads permission already covers, so it works the same there. The web portal doesn't edit rules, so it has nothing to change.

Checks

cargo fmt, cargo clippy --all-targets -- -D warnings, cargo test (two new tests: chosen adverts / deletion, and ids for old adverts), tools/extract_strings.py, tools/check_glyphs.py. Checked in the running app under Xvfb. It merges cleanly with #36.


Generated by Claude Code

…dvertiser name

In a rule's "What plays", choosing the Adverts list now offers "every advert" or
"only the adverts I tick", with a ticked list of the adverts (several can be
ticked). Rules saved before keep playing every advert. Adverts get a stable id
(assigned on load for old settings) and an advertiser / company field, and each
advert shows which rules play it. Deleting an advert removes it from the rules.

Closes #38

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016m2QHUAvwMZBtY3v4DS7m6
@epell-development epell-development self-assigned this Nov 1, 2026

@mergeguards mergeguards Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MergeGuard review
Risk: 🔴 60/100 — risky
Findings: 🔴 1 high
Open Files changed for 1 inline review thread on the diff.

💡 Use the Fix All MergeGuard Findings checkbox comment on this PR to apply auto-fixes in batch, or reply @mergeguards fix on any inline finding.

⚠️ This PR may benefit from a deep scan — consider triggering @mergeguards deep-scan.


Reviewed by MergeGuard AI

Comment thread src/adsui.rs Resolved
@mergeguards

mergeguards Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

MergeGuard agent actions

Fix all findings

Fix-all did not complete.

Manual fixes needed (1)

MergeGuard could not commit these automatically. Expand each file for the suggested fix.

`src/adsui.rs` — Skipped committing — the fix removed closing brace(s) from the enclosing…

Skipped committing — the fix removed closing brace(s) from the enclosing function/block (lines 471-473).

Please apply this change manually — MergeGuard drafted a fix but could not commit it to this branch.

Suggested approach:
The checkbox handler now copies the advert id into a value and uses it consistently, preventing any reference/deref confusion and accidental duplicates. This keeps add/remove logic correct and safe when toggling tick boxes.

Model confidence: 78%.

You can try again with the checkbox:

  • Fix All MergeGuard Findings

Or reply with @mergeguards fix-all.

All issues (1)
  • high · src/adsui.rs:470 — Potential logic error in checkbox state synchronization. When on is true, the code pushes *id to r.ad_ids, but id is already a reference from the iterator. This creates a double-dereference…

@epell-development
epell-development merged commit 07e41d8 into main Nov 1, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Selecting advert from advert list

2 participants