Skip to content

Commit

Permalink
Merge branch 'migration-wrapup' of https://github.com/JGreenlee/e-mis…
Browse files Browse the repository at this point in the history
…sion-phone into migration-wrapup
  • Loading branch information
JGreenlee committed Jan 25, 2024
2 parents d5fe4b4 + cb7b191 commit b0d6e7b
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 11 deletions.
2 changes: 1 addition & 1 deletion package.cordovabuild.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion package.serve.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions www/__mocks__/timelineHelperMocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion www/js/control/ProfileSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ 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,
getReminderPrefs,
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
Expand Down
3 changes: 1 addition & 2 deletions www/js/diary/timelineHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -301,8 +301,7 @@ const points2TripProps = function (locationPoints: Array<BEMData<FilteredLocatio

const speeds: number[] = [];
const dists: number[] = [];
let loc;
let locLatLng: LatLng;
let loc, locLatLng: LatLng;
locationPoints.forEach((pt) => {
const ptLatLng = L.latLng([pt.data.latitude, pt.data.longitude]);
if (loc) {
Expand Down
2 changes: 1 addition & 1 deletion www/js/types/appConfigTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,6 @@ export type ReminderSchemesConfig = {
end?: number;
intervalInDays: number;
}[];
defaultTime: string;
defaultTime?: string; // format is HH:MM in 24 hour time
};
};
14 changes: 9 additions & 5 deletions www/js/types/diaryTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ type UserInput = {
};

export type ConfirmedPlace = {
_id: ObjectId;
additions: UserInputEntry[];
cleaned_place: ObjectId;
duration: number;
Expand All @@ -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]
Expand Down Expand Up @@ -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 =>
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down

0 comments on commit b0d6e7b

Please sign in to comment.