PharmaLedger-IMI / ctr-workspace

UC8 Clinical Trials Recruitment
MIT License
2 stars 0 forks source link

geoLocation optimizations #58

Open joaoluis-pdm opened 2 years ago

joaoluis-pdm commented 2 years ago

Instead of having the browser always asking the user for geoLocation permission, cache last successful geoLocation.

joaoluis-pdm commented 2 years ago

In the last commit, the location is already cached, but some sort of timer needs to be set for that cache to be forgotten. For example, if the patient leaves the app open for a day or more, the location might change significantly.

joaoluis-pdm commented 2 years ago

At this line, https://github.com/PharmaLedger-IMI/ctr-workspace/blob/5fd2eb378c9e230c5665928569752d93c4f2afef/ctr-patient/patient-ssapp/code/scripts/controllers/ClinicalTrialAns40TrialController.js#L66 the self.matchRequest.coords are {}. Why ? (This prevents the matched trial from displaying travel distances).

Apparently the coords: GeolocationCoordinates object (which is browse-native) does survive a setState/getState.

Could be a firefox-only problem: https://stackoverflow.com/questions/11042212/ff-13-ie-9-json-stringify-geolocation-object

joaoluis-pdm commented 2 years ago

Problem worked around in the previous commit.