diff --git a/package.cordovabuild.json b/package.cordovabuild.json index f5f29f48e..f382394e9 100644 --- a/package.cordovabuild.json +++ b/package.cordovabuild.json @@ -137,7 +137,7 @@ "enketo-transformer": "^4.0.0", "fast-xml-parser": "^4.2.2", "fs-extra": "^9.0.1", - "humanize-duration": "3.31.0", + "humanize-duration": "^3.31.0", "i18next": "^23.7.6", "install": "^0.13.0", "jquery": "^3.1.0", diff --git a/package.serve.json b/package.serve.json index 1d813a088..674e2b790 100644 --- a/package.serve.json +++ b/package.serve.json @@ -68,7 +68,7 @@ "enketo-transformer": "^4.0.0", "fast-xml-parser": "^4.2.2", "fs-extra": "^9.0.1", - "humanize-duration": "3.31.0", + "humanize-duration": "^3.31.0", "i18next": "^23.7.6", "install": "^0.13.0", "jquery": "^3.1.0", diff --git a/www/__mocks__/timelineHelperMocks.ts b/www/__mocks__/timelineHelperMocks.ts index 421bb6f3f..c146cb54d 100644 --- a/www/__mocks__/timelineHelperMocks.ts +++ b/www/__mocks__/timelineHelperMocks.ts @@ -47,6 +47,7 @@ const mockConfirmedPlaceData = { enter_ts: 1437578093.881, exit_ts: 1437578093.881, } as unknown as ConfirmedPlace; + // using parse/stringify to deep copy & populate data let tempMetaData = JSON.parse(JSON.stringify(mockMetaData)); tempMetaData.write_ts = 2; diff --git a/www/js/control/ProfileSettings.tsx b/www/js/control/ProfileSettings.tsx index 59342ea34..56c19efe9 100644 --- a/www/js/control/ProfileSettings.tsx +++ b/www/js/control/ProfileSettings.tsx @@ -32,6 +32,7 @@ import { storageClear } from '../plugin/storage'; import { getAppVersion } from '../plugin/clientStats'; import { getConsentDocument } from '../splash/startprefs'; import { displayError, displayErrorMsg, logDebug, logWarn } from '../plugin/logger'; +import { fetchOPCode, getSettings } from '../services/controlHelper'; import { updateScheduledNotifs, getScheduledNotifs, @@ -39,7 +40,6 @@ import { setReminderPrefs, } from '../splash/notifScheduler'; import { DateTime } from 'luxon'; -import { fetchOPCode, getSettings } from '../services/controlHelper'; import { AppConfig } from '../types/appConfigTypes'; //any pure functions can go outside diff --git a/www/js/diary/timelineHelper.ts b/www/js/diary/timelineHelper.ts index ce62b551f..15f4fc003 100644 --- a/www/js/diary/timelineHelper.ts +++ b/www/js/diary/timelineHelper.ts @@ -301,8 +301,7 @@ const points2TripProps = function (locationPoints: Array { const ptLatLng = L.latLng([pt.data.latitude, pt.data.longitude]); if (loc) { diff --git a/www/js/types/appConfigTypes.ts b/www/js/types/appConfigTypes.ts index 6cdc8dda9..8b81063a9 100644 --- a/www/js/types/appConfigTypes.ts +++ b/www/js/types/appConfigTypes.ts @@ -53,6 +53,6 @@ export type ReminderSchemesConfig = { end?: number; intervalInDays: number; }[]; - defaultTime: string; + defaultTime?: string; // format is HH:MM in 24 hour time }; }; diff --git a/www/js/types/diaryTypes.ts b/www/js/types/diaryTypes.ts index 678bbdc6a..954c0315c 100644 --- a/www/js/types/diaryTypes.ts +++ b/www/js/types/diaryTypes.ts @@ -19,6 +19,7 @@ type UserInput = { }; export type ConfirmedPlace = { + _id: ObjectId; additions: UserInputEntry[]; cleaned_place: ObjectId; duration: number; @@ -44,6 +45,11 @@ export type TripTransition = { ts: number; }; +export type LocationCoord = { + type: string; // e.x., "Point" + coordinates: [number, number]; +}; + type CompTripLocations = { loc: { coordinates: [number, number]; // [1,2.3] @@ -116,8 +122,6 @@ export type CompositeTrip = { so a 'timeline entry' is either a trip or a place. */ export type TimelineEntry = ConfirmedPlace | CompositeTrip; -export type TimestampRange = { start_ts: number; end_ts: number }; - /* Type guard to disambiguate timeline entries as either trips or places If it has a 'start_ts' and 'end_ts', it's a trip. Else, it's a place. */ export const isTrip = (entry: TimelineEntry): entry is CompositeTrip => @@ -184,7 +188,7 @@ export type Location = { latitude: number; fmt_time: string; // ISO mode: number; - loc: Geometry; + loc: LocationCoord; ts: number; // Unix altitude: number; distance: number; @@ -193,14 +197,14 @@ export type Location = { // used in readAllCompositeTrips export type SectionData = { end_ts: number; // Unix time, e.x. 1696352498.804 - end_loc: Geometry; + end_loc: LocationCoord; start_fmt_time: string; // ISO time end_fmt_time: string; trip_id: ObjectId; sensed_mode: number; source: string; // e.x., "SmoothedHighConfidenceMotion" start_ts: number; // Unix - start_loc: Geometry; + start_loc: LocationCoord; cleaned_section: ObjectId; start_local_dt: LocalDt; end_local_dt: LocalDt;