From 3ee16a19438c2221a0fa658c9952a7138e28c915 Mon Sep 17 00:00:00 2001 From: Carifio24 Date: Fri, 22 Mar 2024 17:05:23 -0400 Subject: [PATCH] Rename text search locations field for better consistency. --- src/stories/solar-eclipse-2024/database.ts | 14 +++++++------- .../solar-eclipse-2024/models/eclipse_data.ts | 8 ++++---- .../sql/create_eclipse_data_table.sql | 4 ++-- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/stories/solar-eclipse-2024/database.ts b/src/stories/solar-eclipse-2024/database.ts index 0bcb1e1..d5cbc9e 100644 --- a/src/stories/solar-eclipse-2024/database.ts +++ b/src/stories/solar-eclipse-2024/database.ts @@ -15,7 +15,7 @@ export const SolarEclipse2024Entry = S.struct({ user_uuid: S.string, user_selected_locations: LatLonArray, cloud_cover_selected_locations: LatLonArray, - text_search_locations: LatLonArray, + text_search_selected_locations: LatLonArray, 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 }), @@ -27,7 +27,7 @@ export const SolarEclipse2024Entry = S.struct({ export const SolarEclipse2024Update = S.struct({ user_selected_locations: S.optional(LatLonArray, { exact: true }), cloud_cover_selected_locations: S.optional(LatLonArray, { exact: true }), - text_search_locations: S.optional(LatLonArray, { exact: true }), + text_search_selected_locations: S.optional(LatLonArray, { 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 }), @@ -46,7 +46,7 @@ export async function submitSolarEclipse2024Data(data: SolarEclipse2024DataT): P ...data, user_selected_locations_count: data.user_selected_locations.length, cloud_cover_selected_locations_count: data.cloud_cover_selected_locations.length, - text_search_locations_count: data.text_search_locations.length, + text_search_selected_locations_count: data.text_search_selected_locations.length, }; return SolarEclipse2024Data.upsert(dataWithCounts).then(([item, _]) => item); @@ -78,10 +78,10 @@ export async function updateSolarEclipse2024Data(userUUID: string, update: Solar dbUpdate.cloud_cover_selected_locations = selected; dbUpdate.cloud_cover_selected_locations_count = selected.length; } - if (update.text_search_locations) { - const selected = data.text_search_locations.concat(update.text_search_locations); - dbUpdate.text_search_locations = selected; - dbUpdate.text_search_locations_count = selected.length; + if (update.text_search_selected_locations) { + const selected = data.text_search_selected_locations.concat(update.text_search_selected_locations); + dbUpdate.text_search_selected_locations = selected; + dbUpdate.text_search_selected_locations_count = selected.length; } if (update.delta_info_time_ms) { dbUpdate.info_time_ms = data.info_time_ms + update.delta_info_time_ms; diff --git a/src/stories/solar-eclipse-2024/models/eclipse_data.ts b/src/stories/solar-eclipse-2024/models/eclipse_data.ts index 0532384..a6407ad 100644 --- a/src/stories/solar-eclipse-2024/models/eclipse_data.ts +++ b/src/stories/solar-eclipse-2024/models/eclipse_data.ts @@ -7,8 +7,8 @@ export class SolarEclipse2024Data extends Model; declare app_time_ms: CreationOptional; declare advanced_weather_time_ms: CreationOptional; @@ -47,11 +47,11 @@ export function initializeSolarEclipse2024DataModel(sequelize: Sequelize) { type: DataTypes.INTEGER, allowNull: false }, - text_search_locations: { + text_search_selected_locations: { type: DataTypes.JSON, allowNull: false }, - text_search_locations_count: { + text_search_selected_locations_count: { type: DataTypes.INTEGER, allowNull: false }, diff --git a/src/stories/solar-eclipse-2024/sql/create_eclipse_data_table.sql b/src/stories/solar-eclipse-2024/sql/create_eclipse_data_table.sql index 4e6a6e6..d23e23b 100644 --- a/src/stories/solar-eclipse-2024/sql/create_eclipse_data_table.sql +++ b/src/stories/solar-eclipse-2024/sql/create_eclipse_data_table.sql @@ -5,8 +5,8 @@ CREATE TABLE SolarEclipse2024Data ( user_selected_locations_count INT NOT NULL, cloud_cover_selected_locations JSON NOT NULL, cloud_cover_selected_locations_count INT NOT NULL, - text_search_locations JSON NOT NULL, - text_search_locations_count INT NOT NULL, + text_search_selected_locations JSON NOT NULL, + text_search_selected_locations_count INT NOT NULL, app_time_ms INT NOT NULL DEFAULT 0, info_time_ms INT NOT NULL DEFAULT 0, advanced_weather_time_ms INT NOT NULL DEFAULT 0,