diff --git a/src/stories/solar-eclipse-2024/database.ts b/src/stories/solar-eclipse-2024/database.ts index 7292e08..f85bc28 100644 --- a/src/stories/solar-eclipse-2024/database.ts +++ b/src/stories/solar-eclipse-2024/database.ts @@ -17,7 +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, + cloud_cover_selected_locations_count: S.optional(S.number, { exact: true }), 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 }), @@ -40,14 +40,15 @@ export const SolarEclipse2024Update = S.struct({ delta_eclipse_timer_time_ms: S.optional(S.number.pipe(S.int()), { exact: true }), }); -export type SolarEclipse2024DataT = S.Schema.To; +export type SolarEclipse2024EntryT = S.Schema.To; export type SolarEclipse2024UpdateT = S.Schema.To; -export async function submitSolarEclipse2024Data(data: SolarEclipse2024DataT): Promise { +export async function submitSolarEclipse2024Data(data: SolarEclipse2024EntryT): Promise { logger.verbose(`Attempting to submit solar eclipse 2024 measurement for user ${data.user_uuid}`); const dataWithCounts = { ...data, + cloud_cover_selected_locations_count: data.cloud_cover_selected_locations_count ?? data.cloud_cover_selected_locations.length, user_selected_locations_count: data.user_selected_locations.length, text_search_selected_locations_count: data.text_search_selected_locations.length, };