Cht-core: Allow users to specify date for UHC last visited

Created on 8 Apr 2019  路  6Comments  路  Source: medic/cht-core

Currently we always use a visit doc's reported_date field as the basis for the UHC last visited date. Sometimes the form allows the user to enter the date the visit occurred, in which case we should use that field instead.

Update the implementation to look for a specific field in the form to use as the last visited date, falling back to the reported_date.

Make sure the date format that the enketo date picker outputs is compatible with our last visited date implementation.

Original issue: https://github.com/medic/medic-projects/issues/6065

1 - High Improvement

All 6 comments

Ready for AT in 5579-allow-users-to-specify-date-for鈥攗hclast-visited. Make sure if a report has a visited_date field then that field is used for the "last visited date" in the contacts UI. If the report doesn't have a visited_date field then the reported_date should be used instead.

This change looks good to me. This is the form I used to test: https://gist.github.com/dianabarsan/05cb7a0c0d19dda88117088d97a8040b
Maybe it can be some use to you @ngaruko .

Not sure if I am missing something @dianabarsan @wtekeu but when one selects no for specify a home visit date, the last_visit is empty in the db and in the UI.
Form
image

db
image

UI
image

@ngaruko The issue was just about being able to specify visited_date for a home visit. The form (I adapted) is just a means for AT.
This change should be reflected on the LHS families list - if you specify a visited_date, that is the date that the LHS list should use, instead of the reported_date of the report.

LGTM
Before
image

after
image

Merged

Was this page helpful?
0 / 5 - 0 ratings