From 9aab44b7af05721b4ae5fb343c08984415246a69 Mon Sep 17 00:00:00 2001
From: gras <chrisc.gigamail@gmail.com>
Date: Sat, 30 Mar 2024 21:23:10 +0100
Subject: [PATCH] Removed 0 as a rating, since it means unrated.

---
 src/backend/model/fileaccess/MetadataLoader.ts | 2 +-
 test/backend/assets/sidecar/metadata.json      | 1 -
 test/backend/assets/sidecar/metadata_v2.json   | 1 -
 3 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/src/backend/model/fileaccess/MetadataLoader.ts b/src/backend/model/fileaccess/MetadataLoader.ts
index 79abbbf2..5a61af21 100644
--- a/src/backend/model/fileaccess/MetadataLoader.ts
+++ b/src/backend/model/fileaccess/MetadataLoader.ts
@@ -515,7 +515,7 @@ export class MetadataLoader {
     if (exif.xmp &&
       exif.xmp.Rating !== undefined) {
       const rting = Math.round(exif.xmp.Rating);
-      if (rting < 0) {
+      if (rting <= 0) {
         //We map all ratings below 0 to 0. Lightroom supports value -1, but most other tools (including this) don't.
         //Rating 0 means "unrated" according to adobe's spec, so we delete the attribute in pigallery for the same effect
         delete metadata.rating;
diff --git a/test/backend/assets/sidecar/metadata.json b/test/backend/assets/sidecar/metadata.json
index 1f7eab71..3593766b 100644
--- a/test/backend/assets/sidecar/metadata.json
+++ b/test/backend/assets/sidecar/metadata.json
@@ -3,7 +3,6 @@
     "width": 10,
     "height": 5
   },
-  "rating": 0,
   "creationDate": 1710188754000,
   "fileSize": 5095,
   "keywords": [
diff --git a/test/backend/assets/sidecar/metadata_v2.json b/test/backend/assets/sidecar/metadata_v2.json
index ceda26fb..36a37353 100644
--- a/test/backend/assets/sidecar/metadata_v2.json
+++ b/test/backend/assets/sidecar/metadata_v2.json
@@ -5,7 +5,6 @@
   },
   "creationDate": 1710188754000,
   "fileSize": 5095,
-  "rating": 0,
   "keywords": [
     "floor",
     "book",