Ignore list: prevent deleted and found caches from being re-imported

Aperta
#1,008 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
12/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
python

Direzione di ricerca

This is a multi-part design task, not a first contribution. Start by reading the module docstring in src/opensak/importer/gsak_importer.py (#473), then _upsert_cache, count_own_found_logs and FOUND_LOG_TYPES, since the new skip check must run before _upsert_cache. Done means the ignored_caches table and both skip rules work on every import path and are covered by the unit tests listed in the acceptance criteria.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

area: import area: UI improvement
Background

Requested by a member of the Facebook community:

Is there an ignore list to prevent caches I've found, or other caches that I've deleted, from being re-imported into the 'main' database?

OpenSAK has no ignore list today. GSAK users know this feature ("Delete and add to ignore list"), so it belongs alongside the other GSAK-parity work. The GSAK importer also explicitly left GSAK's Ignore list out of scope (see the module docstring in src/opensak/importer/gsak_importer.py, #473).

Why the usual workaround doesn't help: the usual advice is to set the Pocket Query to "I haven't found" on geocaching.com, but that only works for PQs you run yourself. Many users receive PQs through a PQ club, where another member runs the query against their own account. "I haven't found" then filters on the club member's finds, not yours, so your found caches keep arriving with every import. OpenSAK has to handle this on the import side.

Proposal

Two related mechanisms with different semantics:

1. Ignore list (explicit, per cache)
  • New per-database table, e.g. ignored_caches:
    • gc_code (primary key)
    • added_at (timestamp)
    • name (cache name at the time of ignoring, so the list stays readable after the cache row is deleted)
    • note (optional, free text)
  • Per-database, consistent with OpenSAK's independent-database architecture, and matching GSAK's behaviour.
  • Cache list context menu: "Delete and ignore" for single and multi-select. The existing confirmation dialog is reused, with the count shown.
  • Ignore List dialog (e.g. under the Database or Tools menu): list, search, remove entries (un-ignore), and optionally add a GC code manually.
  • Un-ignoring only removes the entry. The cache comes back on the next import that contains it.
2. "Skip caches I've found" import option
  • An import setting, off by default, since many users deliberately keep their finds in a database.
  • A cache counts as "found by me" if either:
    • it already exists in the target database with found = True (covers finds marked via the found-updater / reference database), or
    • the incoming GPX data contains a Found it log (FOUND_LOG_TYPES) by the user's configured geocaching name/ID (same logic as count_own_found_logs).
  • When a found cache is skipped, it is not added to the ignore list, so turning the option off later restores normal behaviour.
  • Open question: if a found cache already exists in the database, should it be left untouched (skip update) or removed? Suggest leave untouched for v1. Removal is something the user can do explicitly with "Delete and ignore".
Importer behaviour (both mechanisms)
  • Applies to every import path: GPX, PQ ZIP, PQ e-mail (IMAP, #443), and GSAK import.
  • The check happens before _upsert_cache, so skipped caches never touch waypoints, logs, attributes or trackables.
  • The import summary reports skipped counts separately, e.g.:
    • N caches skipped (ignore list)
    • N caches skipped (already found)
  • Locked caches (#202) are unaffected. The lock still only protects against overwrite. It does not exclude anything.
Follow-up (separate issue once this lands)
  • GSAK importer: import GSAK's ignore list into ignored_caches, closing the remaining gap noted in #473.
  • Optional: export/import of the ignore list as plain text (one GC code per line), useful for copying between databases.
Out of scope
  • Sharing one ignore list across multiple databases. Each database stays independent.
  • Ignoring by owner, cache type, or other criteria. This is per-GC-code only. Criteria-based exclusion is a filter concern.
Acceptance criteria
  • ignored_caches table created via the existing schema/migration mechanism. Existing databases are upgraded without data loss.
  • "Delete and ignore" in the cache list context menu (single + multi-select) deletes the cache(s) and adds them to the ignore list.
  • Ignore List dialog: view, search, remove, manual add.
  • All import paths (GPX, PQ ZIP, PQ e-mail, GSAK) skip ignored GC codes.
  • "Skip caches I've found" setting (default off) skips found caches as defined above, on all import paths.
  • Import summary shows skipped counts per reason.
  • New strings added to all language files (test_no_missing_keys).
  • Unit tests: ignore-list CRUD, importer skip (ignored), importer skip (found, both detection rules), un-ignore then re-import, migration of an existing database.
  • docs/filters.md / user guide updated with the ignore list and the import option, including the PQ-club explanation.
Lingua principale
Python
Stelle
37
Fork
17
Merge medio
16h 7m
PR unite (30g)
128

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di OpenSAK-Org/OpenSAK

Tutte le issue di OpenSAK-Org/OpenSAK

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.