Make camera parsing resilient to incomplete data

This commit is contained in:
Sam Becker 2024-01-10 08:48:56 -06:00
parent fd2134ae81
commit fdc1d383c1
2 changed files with 3 additions and 1 deletions

View File

@ -222,7 +222,7 @@ export const dateRangeForPhotos = (
};
export const photoHasCameraData = (photo: Photo) =>
photo.make ||
photo.make &&
photo.model;
export const photoHasExifData = (photo: Photo) =>

View File

@ -242,6 +242,8 @@ const sqlGetUniqueCameras = async () => sql`
SELECT DISTINCT make||' '||model as camera, make, model, COUNT(*)
FROM photos
WHERE hidden IS NOT TRUE
AND make IS NOT NULL
AND model IS NOT NULL
GROUP BY make, model
ORDER BY camera ASC
`.then(({ rows }): Cameras => rows.map(({ make, model, count }) => ({