From 82d3049f111851ed6db1cbf9e06902bb8c87a0f4 Mon Sep 17 00:00:00 2001 From: Carifio24 Date: Tue, 26 Mar 2024 00:56:17 -0400 Subject: [PATCH] Expect cloud cover count in request rather than using length of cloud cover list. --- src/stories/solar-eclipse-2024/database.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/stories/solar-eclipse-2024/database.ts b/src/stories/solar-eclipse-2024/database.ts index 18fc972..7292e08 100644 --- a/src/stories/solar-eclipse-2024/database.ts +++ b/src/stories/solar-eclipse-2024/database.ts @@ -17,6 +17,7 @@ export const SolarEclipse2024Entry = S.struct({ cloud_cover_selected_locations: LatLonArray, text_search_selected_locations: LatLonArray, advanced_weather_selected_locations_count: S.number, + cloud_cover_selected_locations_count: S.number, info_time_ms: S.optional(S.number.pipe(S.int()), { exact: true }), app_time_ms: S.optional(S.number.pipe(S.int()), { exact: true }), advanced_weather_time_ms: S.optional(S.number.pipe(S.int()), { exact: true }), @@ -30,6 +31,7 @@ export const SolarEclipse2024Update = S.struct({ cloud_cover_selected_locations: S.optional(LatLonArray, { exact: true }), text_search_selected_locations: S.optional(LatLonArray, { exact: true }), delta_advanced_weather_selected_locations_count: S.optional(S.number, { exact: true }), + delta_cloud_cover_selected_locations_count: S.optional(S.number, { exact: true }), delta_info_time_ms: S.optional(S.number.pipe(S.int()), { exact: true }), delta_app_time_ms: S.optional(S.number.pipe(S.int()), { exact: true }), delta_advanced_weather_time_ms: S.optional(S.number.pipe(S.int()), { exact: true }), @@ -47,7 +49,6 @@ export async function submitSolarEclipse2024Data(data: SolarEclipse2024DataT): P const dataWithCounts = { ...data, user_selected_locations_count: data.user_selected_locations.length, - cloud_cover_selected_locations_count: data.cloud_cover_selected_locations.length, text_search_selected_locations_count: data.text_search_selected_locations.length, }; @@ -88,6 +89,9 @@ export async function updateSolarEclipse2024Data(userUUID: string, update: Solar if (update.delta_advanced_weather_selected_locations_count) { dbUpdate.advanced_weather_selected_locations_count = data.advanced_weather_selected_locations_count + update.delta_advanced_weather_selected_locations_count; } + if (update.delta_cloud_cover_selected_locations_count) { + dbUpdate.cloud_cover_selected_locations_count = data.cloud_cover_selected_locations_count + update.delta_cloud_cover_selected_locations_count; + } if (update.delta_info_time_ms) { dbUpdate.info_time_ms = data.info_time_ms + update.delta_info_time_ms; }