Allow switching back to first deputy after replacing a disqualified deputy
Reproduction: Use «Bytt vara» on a deputy who is marked as disqualified/biased (inhabil), then try to switch back to the first deputy. Observed example in meeting 4: - Klodrik (role 5) still has attendance state `replacing` and `bias_status: bias_replacing`. - Case 01/25 (case 6) is ongoing, and Klodrik remains reserved as Onkel Skrue's bias deputy for that case. - The active voting-engine overlay assigns Klara Ku to Onkel Skrue's seat. Root cause: 1. `Secretary::ParticipantsController#free_deputies` calls `VotingEngine::Query.replacement_candidates` without the ongoing `case_id`. 2. Eligibility sees Klodrik's case-6 reservation, but because the candidate query has `case_id: nil`, `VotingEngine::Eligibility` rejects him. Database verification showed that the candidate list without case context contains only Fetter Anton, while querying with `case_id: 6` contains both Klodrik and Fetter Anton. 3. The UI calculates the status separately. Klodrik is absent from the currently resolved seat participants because Klara occupies the overlay. `ParticipantOverview#state_for` falls back to his attendance, but only maps attendance state `unavailable` to unavailable; `replacing` falls through to `idle`. 4. `Secretary::ParticipantStatusComponent` labels every idle deputy as free/available. Actual behavior: Klodrik is displayed as available but cannot be selected because the case-scoped reservation is evaluated without case context. Expected behavior: Availability must be consistent between the participant status and replacement candidate calculation, and switching back to the first deputy must work when that deputy is eligible for the ongoing case. Relevant code: - `app/controllers/secretary/participants_controller.rb` (`free_deputies`) - `app/services/voting_engine/eligibility.rb` - `app/services/voting_engine/participant_overview.rb` (`state_for`) - `app/components/secretary/participant_status_component.rb` (`status_text`)
Checklist
0 of 0 completeNo checklist items.
- Area
- Kaukus
- Kind
- Bug
- Priority
- High
- Task ID
tsk_gw2x8f4dfx- Updated