This feature automatically saves voting results to a JSON file whenever you switch between panels/events in the MUN Timer application.
- Added
votingResultsobject toappDatato store voting data for each event - Each voting event is identified by its unique event ID
- Voting data includes:
- Vote mode (simple, two-thirds, security council, consensus)
- Vote type (substantive, procedural)
- Vote counts (for/against/abstain) OR Security Council per-member votes
- Timestamp of when data was saved
When: Automatically triggered when you switch away from a voting event to another event
What's Saved:
- Current majority mode and vote type settings
- For numeric voting: For, Against, and Abstain vote counts
- For Security Council voting: Individual vote choices for each member
- All data is stored in
appData.votingResultsobject keyed by event ID
Smart Saving:
- File is only downloaded if voting data has actually changed
- Prevents unnecessary file downloads when just browsing events
- Ignores changes if all votes are still at default values (zeros or default selections)
File Output: Creates/downloads mun-timer-autosave.json file to your Downloads folder
When: Automatically triggered when you switch to a voting event
What's Loaded:
- Restores the majority mode and vote type from last session
- Restores vote counts or Security Council member votes
- Recalculates and displays the voting visualization
- Shows the result (PASSED/FAILED/TIE)
- Navigate to a voting event
- Select your voting mode (Simple Majority, Two Thirds, etc.)
- Enter vote counts or make Security Council selections
- Switch to a different event → Auto-save happens!
- A JSON file
mun-timer-autosave.jsonis downloaded - Switch back to the voting event → Data is restored automatically!
saveVotingData()- Captures current voting state and stores it (only if changed)hasVotingDataChanged()- Compares current voting data with previously saved dataloadVotingData()- Restores voting state when returning to a voting eventautoSaveToFile()- Downloads the complete appData as JSON file
setCurrentEvent()- Now callssaveVotingData()before switching eventsensureDefaults()- InitializesvotingResultsobject if not present- Voting event rendering - Now calls
loadVotingData()after rendering
The auto-saved JSON file contains the complete application state including:
{
"topics": [...],
"events": [...],
"delegates": [...],
"chair": {...},
"votingConfig": {...},
"speechesDefaults": {...},
"votingResults": {
"4": {
"mode": "simple",
"voteType": "substantive",
"forVotes": 8,
"againstVotes": 2,
"abstainVotes": 0,
"timestamp": "2025-10-07T12:34:56.789Z"
}
}
}- No Data Loss: Vote results are preserved when navigating between events
- Easy Review: Return to any voting event to see previous results
- Backup: Auto-save file can be loaded later using "Load JSON" button
- Audit Trail: Each save includes a timestamp
- Seamless UX: Works automatically without user intervention
- Smart Saving: Only downloads file when data actually changes, reducing clutter
To restore a previously saved voting session:
- Click the "Load JSON" button
- Select your
mun-timer-autosave.jsonfile - All voting results will be restored
- Navigate to voting events to see the saved data
- The auto-save file is only downloaded when voting data has changed
- File is NOT downloaded if you just view a voting event without making changes
- File is NOT downloaded if all votes are still at their default values (all zeros)
- Browser settings determine where the file is saved (usually Downloads folder)
- All voting data persists through JSON save/load operations
- The feature works with all voting modes (Simple, Two-Thirds, Security Council, Consensus)