Skip to content

Commit 128385d

Browse files
Fix: Show "Folder is empty" message for empty folders in AI tagging - Remove merge conflict (#1285)
* fixed ai tagging for empty folder * ci: add workflow_dispatch trigger to PR check workflows And lint fix * test: add image_count to sample_folder_details fixture tuple, to fix the test errors * fix: add missing import for ShellExt in main.rs * flint fix * fix the image_count undefined case in folder fetch * fix: make image_count optional in FolderDetails interface * fix: update folder image count check to handle falsy values * fix: remove obsolete rustup-init.exe binary installer * fix: remove workflow_dispatch trigger from PR check workflows --------- Co-authored-by: codex-yv <yourajverma960@gmail.com>
1 parent 0528751 commit 128385d

11 files changed

Lines changed: 214 additions & 49 deletions

File tree

.github/workflows/pr-check-build.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ on:
33
pull_request:
44
paths:
55
- "frontend/**"
6+
7+
68

79
jobs:
810
tauri-build-check:

.github/workflows/pr-check-tests.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ on:
44
pull_request:
55
branches:
66
- main
7-
7+
8+
89
jobs:
910
linting:
1011
runs-on: ubuntu-latest

backend/app/database/folders.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -395,11 +395,11 @@ def db_get_folder_ids_by_paths(
395395

396396

397397
def db_get_all_folder_details() -> (
398-
List[Tuple[str, str, Optional[str], int, bool, Optional[bool]]]
398+
List[Tuple[str, str, Optional[str], int, bool, Optional[bool], int]]
399399
):
400400
"""
401401
Get all folder details including folder_id, folder_path, parent_folder_id,
402-
last_modified_time, AI_Tagging, and taggingCompleted.
402+
last_modified_time, AI_Tagging, taggingCompleted, and image_count.
403403
Returns list of tuples with all folder information.
404404
"""
405405
conn = sqlite3.connect(DATABASE_PATH)
@@ -408,9 +408,18 @@ def db_get_all_folder_details() -> (
408408
try:
409409
cursor.execute(
410410
"""
411-
SELECT folder_id, folder_path, parent_folder_id, last_modified_time, AI_Tagging, taggingCompleted
412-
FROM folders
413-
ORDER BY folder_path
411+
SELECT
412+
f.folder_id,
413+
f.folder_path,
414+
f.parent_folder_id,
415+
f.last_modified_time,
416+
f.AI_Tagging,
417+
f.taggingCompleted,
418+
COUNT(i.id) as image_count
419+
FROM folders f
420+
LEFT JOIN images i ON f.folder_id = i.folder_id
421+
GROUP BY f.folder_id
422+
ORDER BY f.folder_path
414423
"""
415424
)
416425
return cursor.fetchall()

backend/app/routes/folders.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,7 @@ def get_all_folders():
451451
last_modified_time,
452452
ai_tagging,
453453
tagging_completed,
454+
image_count,
454455
) = folder_data
455456
folders.append(
456457
FolderDetails(
@@ -460,6 +461,7 @@ def get_all_folders():
460461
last_modified_time=last_modified_time,
461462
AI_Tagging=ai_tagging,
462463
taggingCompleted=tagging_completed,
464+
image_count=image_count,
463465
)
464466
)
465467

backend/app/schemas/folders.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ class FolderDetails(BaseModel):
3030
last_modified_time: int
3131
AI_Tagging: bool
3232
taggingCompleted: Optional[bool] = None
33+
image_count: int = 0
3334

3435

3536
class GetAllFoldersData(BaseModel):

backend/tests/test_folders.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ def sample_folder_details():
9898
1693526400, # timestamp
9999
True, # AI_Tagging
100100
False, # taggingCompleted
101+
0, # image_count
101102
),
102103
(
103104
"folder-id-2",
@@ -106,6 +107,7 @@ def sample_folder_details():
106107
1693526500,
107108
False,
108109
True,
110+
25,
109111
),
110112
]
111113

docs/backend/backend_python/openapi.json

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2253,6 +2253,11 @@
22532253
}
22542254
],
22552255
"title": "Taggingcompleted"
2256+
},
2257+
"image_count": {
2258+
"type": "integer",
2259+
"title": "Image Count",
2260+
"default": 0
22562261
}
22572262
},
22582263
"type": "object",
@@ -3407,6 +3412,119 @@
34073412
"type"
34083413
],
34093414
"title": "ValidationError"
3415+
},
3416+
"app__schemas__face_clusters__ErrorResponse": {
3417+
"properties": {
3418+
"success": {
3419+
"type": "boolean",
3420+
"title": "Success",
3421+
"default": false
3422+
},
3423+
"message": {
3424+
"anyOf": [
3425+
{
3426+
"type": "string"
3427+
},
3428+
{
3429+
"type": "null"
3430+
}
3431+
],
3432+
"title": "Message"
3433+
},
3434+
"error": {
3435+
"anyOf": [
3436+
{
3437+
"type": "string"
3438+
},
3439+
{
3440+
"type": "null"
3441+
}
3442+
],
3443+
"title": "Error"
3444+
}
3445+
},
3446+
"type": "object",
3447+
"title": "ErrorResponse"
3448+
},
3449+
"app__schemas__folders__ErrorResponse": {
3450+
"properties": {
3451+
"success": {
3452+
"type": "boolean",
3453+
"title": "Success",
3454+
"default": false
3455+
},
3456+
"message": {
3457+
"anyOf": [
3458+
{
3459+
"type": "string"
3460+
},
3461+
{
3462+
"type": "null"
3463+
}
3464+
],
3465+
"title": "Message"
3466+
},
3467+
"error": {
3468+
"anyOf": [
3469+
{
3470+
"type": "string"
3471+
},
3472+
{
3473+
"type": "null"
3474+
}
3475+
],
3476+
"title": "Error"
3477+
}
3478+
},
3479+
"type": "object",
3480+
"title": "ErrorResponse"
3481+
},
3482+
"app__schemas__images__ErrorResponse": {
3483+
"properties": {
3484+
"success": {
3485+
"type": "boolean",
3486+
"title": "Success",
3487+
"default": false
3488+
},
3489+
"message": {
3490+
"type": "string",
3491+
"title": "Message"
3492+
},
3493+
"error": {
3494+
"type": "string",
3495+
"title": "Error"
3496+
}
3497+
},
3498+
"type": "object",
3499+
"required": [
3500+
"message",
3501+
"error"
3502+
],
3503+
"title": "ErrorResponse"
3504+
},
3505+
"app__schemas__user_preferences__ErrorResponse": {
3506+
"properties": {
3507+
"success": {
3508+
"type": "boolean",
3509+
"title": "Success"
3510+
},
3511+
"error": {
3512+
"type": "string",
3513+
"title": "Error"
3514+
},
3515+
"message": {
3516+
"type": "string",
3517+
"title": "Message"
3518+
}
3519+
},
3520+
"type": "object",
3521+
"required": [
3522+
"success",
3523+
"error",
3524+
"message"
3525+
],
3526+
"title": "ErrorResponse",
3527+
"description": "Error response model"
34103528
}
34113529
}
34123530
}

0 commit comments

Comments
 (0)