Skip to content

Book moves: auto-create the leaf destination category (sub-category)#92

Open
Y-PLONI wants to merge 1 commit into
kdroidFilter:masterfrom
Otzaria:position-changes-subcategory
Open

Book moves: auto-create the leaf destination category (sub-category)#92
Y-PLONI wants to merge 1 commit into
kdroidFilter:masterfrom
Otzaria:position-changes-subcategory

Conversation

@Y-PLONI

@Y-PLONI Y-PLONI commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

What

Book moves (book_moves.csv) previously required both the source and the full destination category path to already exist; a missing destination failed the task with no auto-creation.

This changes the destination handling so the final (leaf) segment of the destination path is created automatically if missing. All parent segments must still exist, and the source path is unchanged (it must fully resolve). This lets a position change create a new sub-category, and makes the operation idempotent (re-running finds the now-existing leaf instead of recreating it).

Details

  • New resolveOrCreateDestCategory() resolves the destination path, creating only the missing leaf (returns null if a non-leaf parent is missing).
  • New createCategory() inserts the category with level = parent.level + 1 and logs the creation.
  • applyBookMove() now resolves the destination via resolveOrCreateDestCategory() instead of resolveCategoryPath(); the error message clarifies that only the final segment is auto-created.
  • Doc comments updated accordingly.

Single-file change to RenameCategoriesPostProcess.kt.

@Y-PLONI

Y-PLONI commented Jun 27, 2026

Copy link
Copy Markdown
Contributor Author

@kdroidFilter
ההודעה הקודמת של הAI - כעת זו שלי 😉


הקומיט הזה נועד להוסיף קטגוריה כשרשימת ההחלפות מעבירה למיקום שלא קיים.
זה נועד למצב בו אנו מאחדים קבוצת ספרים (למשל: כל ספרי "ילקוט שמעוני") לתיקייה אחת - והיא לא קיימת, ליצור אותה.


אם תבחר שלא לקבל את הPR, אני פשוט אשכפל את הקובץ:
https://github.com/Otzaria/otzaria-library/blob/main/ForDB/book_moves.csv
ואנקה אותו, כך שהבנייה שלך לא תישבר (ואני אשתמש בקובץ המשוכפל).
כרגע, ללא תיקון זה לא ניתן לבנות את הDB.


אשמח לתגובה!

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