(user, app_id, sync_date, version)
return False
This function does not save the user.
    :return: True if user updated
This function does not save the user.
    :return: True if user updated
This function does not save the user . : return : True if user updated
def update_last_sync(user, app_id, sync_date, version):
    """
    This function does not save the user.
    :return: True if user updated
    """
    from corehq.apps.users.models import LastSync
    last_sync = filter_by_app(user.reporting_metadata.last_syncs, app_id)
    if _last_sync_needs_update(last_sync, sync_date):
        if last_sync is None:
            last_sync = LastSync()
            user.reporting_metadata.last_syncs.append(last_sync)
        last_sync.sync_date = sync_date
        last_sync.build_version = version
        last_sync.app_id = app_id

        if _last_sync_needs_update(user.reporting_metadata.last_sync_for_user, sync_date):
            user.reporting_metadata.last_sync_for_user = last_sync

        return True
    return False
def update_last_sync ( user , app_id , sync_date , version ) : from corehq . apps . users . models import LastSync last_sync = filter_by_app ( user . reporting_metadata . last_syncs , app_id ) if _last_sync_needs_update ( last_sync , sync_date ) : if last_sync is None : last_sync = LastSync ( ) user . reporting_metadata . last_syncs . append ( last_sync ) last_sync . sync_date = sync_date last_sync . build_version = version last_sync . app_id = app_id if _last_sync_needs_update ( user . reporting_metadata . last_sync_for_user , sync_date ) : user . reporting_metadata . last_sync_for_user = last_sync return True return False