mWater / mwater-forms

Forms controls for mWater
GNU Lesser General Public License v3.0
3 stars 5 forks source link

sites with code null should not be allowed in SiteQuestions #201

Open broncha opened 6 years ago

broncha commented 6 years ago

SiteQuestions with answer {"value": {"code": null}} are allowed. Sites with code null should not be allowed!

broncha commented 6 years ago

Fixed with e070732

grassick commented 6 years ago

Example: Luke Dumbula-65LLBM (c9b41673e05d429c9cefead73e5a5719) from form a418ea5c1cc5457083d0a6f4cc473096, deployment 4a1e34d1130649aaa1da38bfba79974b and user 2a9a147253014372a445367f03f46a0e.

Question "a5b138b7290e4af0be7c2717672a5acd": {"value": {"code": null}}

Location metadata: {"accuracy": 8.5, "altitude": 695.7000122070312, "latitude": -15.6552229, "longitude": 34.8829554, "altitudeAccuracy": null}

Seeing if sanitation facility site can be found:

select * from entities.sanitation_facility where _created_by = '2a9a147253014372a445367f03f46a0e'

User created 367 sanitation facilities._created_on is no help as set by server.

select _id, st_distance_sphere(st_setsrid(st_makepoint(34.8829554, -15.6552229), 4326), st_transform(location, 4326))
from entities.sanitation_facility where _created_by = '2a9a147253014372a445367f03f46a0e'
order by 2 asc

Finds 1 candidate: 119a4966-2472-4108-aca9-328030b2446a (6 meters away) Malita chanthera,Near mango tree ,7903241

Not used in any other survey:

SELECT * FROM responses 
where 
form = 'a418ea5c1cc5457083d0a6f4cc473096'
and
data#>>'{a5b138b7290e4af0be7c2717672a5acd,value, code}' ='7903241'

Image metadata could give more precise date/time?

grassick commented 6 years ago

Image is [{"id": "dea62ed1497144f19bf4d45b37ac2227", "cover": true, "rotation": 90}]

Image hasn't been uploaded yet, so not yet.