mirror of
https://github.com/Second-Hand-Friends/kleinanzeigen-bot.git
synced 2026-07-09 20:51:05 +02:00
## ℹ️ Description When re-downloading an ad that is already saved locally (via `--ads=all` or numeric IDs), the ad YAML is atomically replaced. The download only scrapes fields from the live page, so all **local-only settings** are reset to defaults or zero: | Field | What happens | |---|---| | `auto_price_reduction` | Reset to `AdDefaults` value (or `null`) | | `republication_interval` | Reset to `AdDefaults` value (or `null`) | | `repost_count` | Reset to `0` — bot forgets how many times it published | | `price_reduction_count` | Reset to `0` — bot forgets auto-reduction progress | The `new` selector avoids this by skipping already-saved ads, but `all` and numeric IDs do not. - Link to the related issue(s): N/A ## 📋 Changes Summary - Add `download.preserve_local_settings` config option (default: `true`) - Add `--preserve-local-settings` CLI flag with help text (English + German) - In `download_ad()`, when re-downloading an existing ad with the toggle enabled, preserve four local-only fields from the existing YAML: `auto_price_reduction`, `republication_interval`, `repost_count`, `price_reduction_count` - Uses validate-then-commit pattern: candidate values are staged on a model copy, validated, then committed only on success - Added test verifying local fields survive re-download - Regenerated schemas and config defaults - Updated German translations for new log messages ### ⚙️ Type of Change - [x] 🐞 Bug fix - [x] ✨ New feature - [ ] 💥 Breaking change ## ✅ Checklist - [x] I have reviewed my changes to ensure they meet the project's standards. - [x] I have tested my changes and ensured that all tests pass (`pdm run test`). - [x] I have formatted the code (`pdm run format`). - [x] I have verified that linting passes (`pdm run lint`). - [x] I have updated documentation where necessary. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added `--preserve-local-settings` CLI flag to retain local ad settings during re-downloads (including auto price reduction, republication interval, and repost count). * Settings now preserved by default; re-downloading existing ads maintains local configurations instead of resetting to defaults. * **Documentation** * Updated configuration guide with details on the new `preserve_local_settings` option. * **Tests** * Added unit tests for CLI flag parsing and preservation logic during ad re-downloads. <!-- end of auto-generated comment: release notes by coderabbit.ai -->