road86 / bahis-desk

Desktop application for BAHIS2
GNU General Public License v3.0
2 stars 1 forks source link

fix: lock geolocation in forms #61

Closed ChasNelson1990 closed 1 year ago

ChasNelson1990 commented 1 year ago

Description

This PR (and one in bahis-serve) are an attempt to solve the geolocation problem described in #60 and elsewhere.

Essentially, there are two fairly big changes:

  1. We store the user's upazila ID in the local DB an use this as "truth" for the user's geolocation
  2. Whenever a form is loaded we hide the geolocation fields from the user; we then fill this fields based on the user's upazila in the local DB

TODO / questions

closes #60 requires road86/bahis-serve#14

Database Changes (delete if not applicable)

Yes, when a new DB is 'prepared' it will now force upazila to be an integer and not text.

Checklist

ChasNelson1990 commented 1 year ago

My latest commit now catches users logging in with an existing local users table. If there is no upazila in it, it drops that table, creates a new one and then logs in as if it was the first time - other existing tables shouldn't be modified by this and so users shouldn't need to run a sync like a real first-time user would.

I have tested this using latest commit bahis-desk with dev-server bahis-serve; it's fine as the old bahis-serve doesn't return an upazila this catch is caught on every log in. This scenario shouldn't happen as we roll out bahis-serve changes before bahis-desk.

I have tested this using latest commit bahis-desk with latest commit bahis-serve; it's fine as this is exactly what the catch is written for.

I have tested this using previous release bahis-desk with latest commit bahis-serve; it's fine as the old bahis-desk just ignores the spare upazila field returned by new bahis-serve.

mixmixmix commented 1 year ago

Whenever a form is loaded we hide the geolocation fields from the user; we then fill this fields based on the user's upazila in the local DB

So we are "hard coding" the upazlia location for all forms? Seem like a good enough hack.

ChasNelson1990 commented 1 year ago

So we are "hard coding" the upazlia location for all forms? Seem like a good enough hack.

Aye.