BUG: Add images to album: success message shows requested count, not number actually added
Maintainers usually reply within 4 days
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 84/100
Research direction
Read backend/app/routes/albums.py and backend/app/database/albums.py to trace how many rows the database function inserts and how the route builds its response. Add route and database tests for mixed valid and invalid IDs, IDs already in the album, and repeated IDs; the success message should report the number actually added. Run the relevant tests for these files.
Written by the indexing model from the issue text.
Description
Is there an existing issue for this?
- I have searched the existing issues
What happened?
I was reading through the album routes and noticed the "Added N images" message uses the length of the request, not what was actually inserted.
Where
backend/app/routes/albums.py (~line 375):
db_add_images_to_album(album_id, body.image_ids)
request_metadata_export(app_state)
return SuccessResponse(
success=True, msg=f"Added {len(body.image_ids)} images to album"
)
db_add_images_to_album() in backend/app/database/albums.py only inserts IDs that exist in images, uses INSERT OR IGNORE, and returns nothing, so the route can't know how many rows were really added.
What I think happens
- One existing ID plus one nonexistent ID: one row should be inserted, but the message should say "Added 2 images to album".
- An ID already in the album is skipped by
INSERT OR IGNOREbut should still be counted in the message. - A repeated ID in one request should be counted twice in the message but inserted once.
I found this by reading the code and the existing tests. The existing 404 test mocks the DB function, so mixed valid/invalid IDs aren't covered.
Possible fix
Return cursor.rowcount from db_add_images_to_album() and use it in the route message, plus a route test and a DB test for the mixed and already-in-album cases.
Record
- I agree to follow this project's Code of Conduct
- Dominant language
- Python
- Stars
- 322
- Forks
- 793
- Avg merge
- 6d 9h
- Merged PRs (30d)
- 20
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from AOSSIE-Org/PictoPy
-
BUG: Semantic search sees portrait phone photos sideways (SigLIP ignores EXIF orientation)Possibly taken @jayssSmm claimed this 1 day ago. Openbug enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
AOSSIE-Org/PictoPy#1780 · 5 comments ·
Maintainers usually reply within 4 days
-
BUG: Share password loses leading/trailing spaces so the password you set doesn't workPossibly taken @swastiksharma45 claimed this 2 days ago. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
AOSSIE-Org/PictoPy#1779 · 2 comments ·
Maintainers usually reply within 4 days
-
BUG: PROD: Face search shows "No Matches Found" for every empty result, even when AI tagging is offPossibly taken @dhruvbit claimed this 3 days ago. Openbug enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
AOSSIE-Org/PictoPy#1770 · 3 comments ·
Maintainers usually reply within 4 days
-
BUG: /sync-folder does not validate the supplied folder_idMay be free again @sathvikn113 claimed this 10 days ago, and no pull request is open. Openbug possible-duplicate
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
AOSSIE-Org/PictoPy#1731 · 5 comments ·
Maintainers usually reply within 4 days
-
DOC: update deprecated libgl1-mesa-glx package and stale setup.md referencesMay be free again @avika269 claimed this 10 days ago, and no pull request is open. Opendocumentation
Difficulty 1/5 1-3 hours Newbie friendliness 65/100
AOSSIE-Org/PictoPy#1730 · 5 comments ·
Maintainers usually reply within 4 days
All issues in AOSSIE-Org/PictoPy
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
bad-antics/lateralus-lang#1140 ·
Maintainers usually reply within 4 days
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 3 days
-
fixture good first issue help wanted vendor:cisco
Difficulty 1/5 1-3 hours Newbie friendliness 85/100