Skip to content

Fix duplicate mods and missing downloads for exmod files#7

Open
AgentKush wants to merge 3 commits into
mainfrom
fix/duplicate-mods-and-missing-downloads
Open

Fix duplicate mods and missing downloads for exmod files#7
AgentKush wants to merge 3 commits into
mainfrom
fix/duplicate-mods-and-missing-downloads

Conversation

@AgentKush
Copy link
Copy Markdown
Owner

Summary

Fixes two issues reported on the live site:

1. Duplicate mods on the mods listing page

  • Mod.fetch_all now deduplicates by [name, author_slug] before sorting
  • If Firestore contains multiple documents for the same mod (different doc IDs, same name+author), only the first is kept

2. Missing download buttons for exmod-only mods

  • Added :exmod (without the z) as a supported file type in preferred_type and download_types
  • Previously only :pak, :zip, and :exmodz were recognized — mods with only :exmod files showed no download button
  • Affected mods: Larkwell Care Package, Mini Map
  • Also updated the show page EXMOD notice to trigger for both exmod and exmodz files

Changes

  • app/models/mod.rb — Added exmod? method, added :exmod to preferred_type and download_types, added .uniq dedup to fetch_all
  • app/views/mods/show.html.erb — EXMOD notice now checks both exmodz? and exmod?
  • spec/models/mod_spec.rb — Updated specs for exmod support and added deduplication test

Cross-fork PR

This needs to be opened as a PR on DonovanMods/project_daedalus (our PAT can't create PRs on upstream).

🤖 Generated with Claude Code

Two issues fixed:

1. Duplicate mods: Added deduplication by name+author in fetch_all
   so duplicate Firestore documents don't produce repeated entries
   on the mods listing page.

2. Missing downloads: Added :exmod support to preferred_type and
   download_types. Mods with only an exmod file (not exmodz) were
   showing no download button because exmod wasn't in the allowed
   file type list. Also updated the show page EXMOD notice to
   trigger for both exmod and exmodz files.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Split filter_map chain into variable + separate uniq/sort call
- Extract firestore_doc helper method to reduce let count and test length
- Remove mod_firestore_obj2 let in favor of inline helper calls

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Makes freeze_time, travel_to, and travel available globally
in specs for deterministic time-dependent tests.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

1 participant