-
-
Notifications
You must be signed in to change notification settings - Fork 602
Open
Description
Is there an existing issue for this?
- I have searched the existing issues
What happened?
Description
All memory cards in the Memory Section are displaying the same tag, ‘Location’, even when the latitude and longitude values are null or the location name is empty. As a result, the sorting buttons do not produce accurate results.
Steps to reproduce
(Add some images I.e. 200)
- Launch PictoPy on your desktop.
- Click Memories Button on sidebar
- Observe that all memory cards display the ‘Location’ tag, even when no location data is available.
- Notice that the sorting buttons do not show appropriate values or results.
Expected Behaviour
- Memories that have a location (i.e., a location_name) should display the
Locationtag. - Memories without a location should display the
Datetag instead. - The sorting buttons should show appropriate values and produce results accordingly.
Implementation
- When memory type is not a
Locationin_create_simple_memoryinmemor_clustering.pythenlocation_name = Noneand it's category will be'Date'and addedtotal_locationto get total memories which has location.
# function to count total memories which has location
# this can also be done in tsx.
def find_total_location_memories(data:list) -> int:
tlm = 0 # total location memories
for memory in data:
if memory["location_name"] != None:
tlm +=1
return tlm return {
"data": {
"memory_count": len(memories),
"image_count": len(images),
"memories": memories,
},
"total_location":tlm, #new key
"success": True,
"message": f"{len(memories)} memories ({location_count} location, {date_count} date)",
}The above part can be done directly in frontend section
Updated locationCount Source:InMemoriesPage.tsx, thelocationCount(displayed on the "Location" filter button) is now primarily taken from thetotal_locationfield returned by the backend's /api/memories/generate endpoint. If the data is not yet available, it falls back to a local calculation.Location Tag Visibility:InMemoryCard.tsx, the "Location" badge is now displayed only when the location_name is not null. I updated the isDateBased logic to check for the absence oflocation_nameinstead ofgeographic coordinates.Refined Filtering:InMemoriesPage.tsx, the filtering logic for the Location and Date buttons has been updated to use thelocation_namefield. Clicking "Location" now correctly displays only memory cards wherelocation_nameis not null, ensuring consistent behavior between the counts and the displayed cards.
Screenshots
Before Screenshots:
- Displaying location tag even if there is no location available for this image
After Screenshots:
Record
- I agree to follow this project's Code of Conduct
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels


