Dates: serve the display wall clock (wall_clock) to clients
Every payload a client renders a capture time from now carries `wall_clock`, a naive ISO-8601 string computed by the existing `date_view::row_display_wall`: the camera's wall clock (true instant + camera offset; the owner's display zone without an offset), with the per-source fallback for unconverted rows. Clients render it verbatim and do no zone math, which is the FileViewer-React #33 / Apollo #37 flip with the rule kept server-side: the drain's permanent `date_utc IS NULL` floor (#120: edited/exported files) would otherwise force every client to carry the per-source legacy conventions forever, and insight prompts already use the same function, so prompt and UI agree by construction. - `/image/metadata` (+ the GPS / date / date-clear mutation responses): `file_wall_clock` — the row's wall, else the filename-class date, else the earliest fs time in the display zone (unindexed files). - `/memories` items and `/photos/gps-summary` photos: `row_wall_clock`. - `get_all_with_gps` returns full rows instead of a 7-tuple that dropped `date_taken_source`, which unconverted rows need. - `date_view::owner_display_zone` resolves prefs -> app default per request. Legacy fields are untouched, so current clients see byte-identical responses (additive; safe to deploy ahead of the client flip, per #120). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e0c6c696f2
commit
e2f33684c8
8 files changed
+257
-93
No files matched your search
+17
-31
@@ -1100,27 +1100,24 @@ pub async fn get_gps_summary(
|
||||
let mut exif_dao_guard = exif_dao.lock().expect("Unable to get ExifDao");
|
||||
match exif_dao_guard.get_all_with_gps(&requested_path, recursive) {
|
||||
Ok(gps_data) => {
|
||||
let display_zone = crate::date_view::owner_display_zone(&app_state.user_ai_prefs_dao);
|
||||
let server_zone = crate::camera_tz::server_zone();
|
||||
let mut photos: Vec<GpsPhotoSummary> = gps_data
|
||||
.into_iter()
|
||||
.map(
|
||||
|(
|
||||
path,
|
||||
lat,
|
||||
lon,
|
||||
date_taken,
|
||||
date_utc,
|
||||
camera_offset_minutes,
|
||||
date_taken_tz_source,
|
||||
)| GpsPhotoSummary {
|
||||
path,
|
||||
lat,
|
||||
lon,
|
||||
date_taken,
|
||||
date_utc,
|
||||
camera_offset_minutes,
|
||||
date_taken_tz_source,
|
||||
},
|
||||
)
|
||||
.filter_map(|row| {
|
||||
let wall_clock =
|
||||
crate::date_view::row_wall_clock(&row, display_zone, server_zone);
|
||||
Some(GpsPhotoSummary {
|
||||
lat: row.gps_latitude? as f64,
|
||||
lon: row.gps_longitude? as f64,
|
||||
path: row.file_path,
|
||||
date_taken: row.date_taken,
|
||||
date_utc: row.date_utc,
|
||||
camera_offset_minutes: row.camera_offset_minutes,
|
||||
date_taken_tz_source: row.date_taken_tz_source,
|
||||
wall_clock,
|
||||
})
|
||||
})
|
||||
.collect();
|
||||
|
||||
// Sort by date_taken based on request, defaulting to ascending (oldest to newest)
|
||||
@@ -1632,18 +1629,7 @@ mod tests {
|
||||
&mut self,
|
||||
_base_path: &str,
|
||||
_recursive: bool,
|
||||
) -> Result<
|
||||
Vec<(
|
||||
String,
|
||||
f64,
|
||||
f64,
|
||||
Option<i64>,
|
||||
Option<i64>,
|
||||
Option<i32>,
|
||||
Option<String>,
|
||||
)>,
|
||||
DbError,
|
||||
> {
|
||||
) -> Result<Vec<crate::database::models::ImageExif>, DbError> {
|
||||
todo!()
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user