@@ -17,6 +17,7 @@ export const SolarEclipse2024Entry = S.struct({
17
17
cloud_cover_selected_locations : LatLonArray ,
18
18
text_search_selected_locations : LatLonArray ,
19
19
advanced_weather_selected_locations_count : S . number ,
20
+ cloud_cover_selected_locations_count : S . optional ( S . number , { exact : true } ) ,
20
21
info_time_ms : S . optional ( S . number . pipe ( S . int ( ) ) , { exact : true } ) ,
21
22
app_time_ms : S . optional ( S . number . pipe ( S . int ( ) ) , { exact : true } ) ,
22
23
advanced_weather_time_ms : S . optional ( S . number . pipe ( S . int ( ) ) , { exact : true } ) ,
@@ -30,6 +31,7 @@ export const SolarEclipse2024Update = S.struct({
30
31
cloud_cover_selected_locations : S . optional ( LatLonArray , { exact : true } ) ,
31
32
text_search_selected_locations : S . optional ( LatLonArray , { exact : true } ) ,
32
33
delta_advanced_weather_selected_locations_count : S . optional ( S . number , { exact : true } ) ,
34
+ delta_cloud_cover_selected_locations_count : S . optional ( S . number , { exact : true } ) ,
33
35
delta_info_time_ms : S . optional ( S . number . pipe ( S . int ( ) ) , { exact : true } ) ,
34
36
delta_app_time_ms : S . optional ( S . number . pipe ( S . int ( ) ) , { exact : true } ) ,
35
37
delta_advanced_weather_time_ms : S . optional ( S . number . pipe ( S . int ( ) ) , { exact : true } ) ,
@@ -38,16 +40,16 @@ export const SolarEclipse2024Update = S.struct({
38
40
delta_eclipse_timer_time_ms : S . optional ( S . number . pipe ( S . int ( ) ) , { exact : true } ) ,
39
41
} ) ;
40
42
41
- export type SolarEclipse2024DataT = S . Schema . To < typeof SolarEclipse2024Entry > ;
43
+ export type SolarEclipse2024EntryT = S . Schema . To < typeof SolarEclipse2024Entry > ;
42
44
export type SolarEclipse2024UpdateT = S . Schema . To < typeof SolarEclipse2024Update > ;
43
45
44
- export async function submitSolarEclipse2024Data ( data : SolarEclipse2024DataT ) : Promise < SolarEclipse2024Data | null > {
46
+ export async function submitSolarEclipse2024Data ( data : SolarEclipse2024EntryT ) : Promise < SolarEclipse2024Data | null > {
45
47
logger . verbose ( `Attempting to submit solar eclipse 2024 measurement for user ${ data . user_uuid } ` ) ;
46
48
47
49
const dataWithCounts = {
48
50
...data ,
51
+ cloud_cover_selected_locations_count : data . cloud_cover_selected_locations_count ?? data . cloud_cover_selected_locations . length ,
49
52
user_selected_locations_count : data . user_selected_locations . length ,
50
- cloud_cover_selected_locations_count : data . cloud_cover_selected_locations . length ,
51
53
text_search_selected_locations_count : data . text_search_selected_locations . length ,
52
54
} ;
53
55
@@ -88,6 +90,9 @@ export async function updateSolarEclipse2024Data(userUUID: string, update: Solar
88
90
if ( update . delta_advanced_weather_selected_locations_count ) {
89
91
dbUpdate . advanced_weather_selected_locations_count = data . advanced_weather_selected_locations_count + update . delta_advanced_weather_selected_locations_count ;
90
92
}
93
+ if ( update . delta_cloud_cover_selected_locations_count ) {
94
+ dbUpdate . cloud_cover_selected_locations_count = data . cloud_cover_selected_locations_count + update . delta_cloud_cover_selected_locations_count ;
95
+ }
91
96
if ( update . delta_info_time_ms ) {
92
97
dbUpdate . info_time_ms = data . info_time_ms + update . delta_info_time_ms ;
93
98
}
0 commit comments