Based on a review of v3/server/pages.py (and related templates like voter.ezt), here are the identified issues, errors, and areas for improvement. These focus on correctness, logic, security, and completeness, while adhering to project conventions (minimal changes, no unsolicited refactors). Prioritized by impact.
manage.ezt template includes JavaScript that makes POST requests to /do-set-open_at/<eid> and /do-set-close_at/<eid> for auto-saving open/close dates. These endpoints were not defined in pages.py, causing the auto-save functionality to fail (likely with 404 errors)._set_election_date to handle common logic (auth, JSON parsing, validation, setting dates, logging, and response). Endpoints now require authentication, validate dates, and log actions. CSRF handling remains a TODO (placeholder token in use). Test for proper date-setting and error handling. Added supporting methods set_open_at and set_close_at to the Election class in election.py, and corresponding cursors in queries.yaml.voter_page() - RESOLVEDvoter.ezt template checks for [if-any upcoming] and loops over upcoming elections, but voter_page() only sets result.election (for open elections). result.upcoming is never defined, so the “Upcoming Elections” section will always be empty.upcoming_to_pid to return editable elections for a given PID with voting eligibility. Added corresponding query q_upcoming_to_me in queries.yaml. Updated voter_page() to fetch and post-process upcoming elections into result.upcoming. Updated voter.ezt to include a dedicated “Upcoming Elections” section with similar card layout, a “Preview Ballot” link, and subtle visual distinction (lighter background, “Upcoming” badge). No filtering on open_at (all editable elections included).vtype in do_add_issue_endpoint()vtype is hardcoded to 'yna', and kv = None. The comment mentions handling SEATS for STV, but it's not implemented. If users try to add STV issues, it will fail or behave incorrectly.vtype dynamic (e.g., from form data). For STV, parse seats from the form and set kv = {'seats': int(form.seats)} or similar. Update the template's form to include a vtype selector and STV-specific fields.print('FORM:', form) in do_add_issue_endpoint() and do_edit_issue_endpoint() is leftover debug code.print statements.issue_count Hack in postprocess_election()if 'issue_count' not in e: e.issue_count = 5 is a hardcoded placeholder.issue_count properly, then remove this.basic.csrf_token = 'placeholder' is not secure.### check authz comments but no implementation. If authorization beyond basic auth is needed, add it (e.g., ensure the user owns the election).do_open_endpoint() assume success; add try/except for potential Election class errors.If you'd like to implement any of these fixes (e.g., add the date endpoints or fix upcoming elections), provide confirmation and details. Let me know if you have more context or want to check specific sections!
submitFormWithLoadingsubmitFormWithLoading, the page doesn't reload, and the button stays disabled, potentially confusing users.