Can a supervisor see the last time a worker synced their device

commcare

I am working on a supervisor app that uses user configurable reports (UCRs) to show aggregate data of the workers the supervisor oversees. Supervisors see worker performance data as well as information about the worker's clients. In order for the supervisor's UCRs to show the most recent data, two things must happen:

  1. The worker must sync her device
  2. The supervisor must sync her device

When supervisors go to visit their workers, it can take a long time for workers to sync their devices if they have not done this in a while. Supervisors would like to be able to see when workers last synced their devices so they can instruct the workers to do so ahead of time if it has been a while since they last synced.

Is there a way to display the last time a worker synced her device to the supervisor?

Best Answer

You can add a column to your UCR which contains the date of the user's last sync. The property on the user that you want is:

reporting_metadata.last_sync_for_user.sync_date

You can use this as is if your UCR is based off users but if it's based off forms or cases you'll need to use a related_doc expression to get the user.