(user, app_id, date, version, build_profile_id=None)
return changed
determines whether to update the last build attributes in a user's reporting metadata
determines whether to update the last build attributes in a user's reporting metadata
determines whether to update the last build attributes in a user s reporting metadata
def update_latest_builds(user, app_id, date, version, build_profile_id=None):
    """
    determines whether to update the last build attributes in a user's reporting metadata
    """
    from corehq.apps.users.models import LastBuild
    last_build = filter_by_app(user.reporting_metadata.last_builds, app_id)
    changed = False
    if _last_build_needs_update(last_build, date):
        if last_build is None:
            last_build = LastBuild()
            user.reporting_metadata.last_builds.append(last_build)
        last_build.build_version = version
        last_build.app_id = app_id
        # update only when passed to avoid over writing set value
        if build_profile_id is not None:
            last_build.build_profile_id = build_profile_id
        last_build.build_version_date = date
        changed = True

    if _last_build_needs_update(user.reporting_metadata.last_build_for_user, date):
        user.reporting_metadata.last_build_for_user = last_build
        changed = True

    return changed
def update_latest_builds ( user , app_id , date , version , build_profile_id = None ) : from corehq . apps . users . models import LastBuild last_build = filter_by_app ( user . reporting_metadata . last_builds , app_id ) changed = False if _last_build_needs_update ( last_build , date ) : if last_build is None : last_build = LastBuild ( ) user . reporting_metadata . last_builds . append ( last_build ) last_build . build_version = version last_build . app_id = app_id # update only when passed to avoid over writing set value if build_profile_id is not None : last_build . build_profile_id = build_profile_id last_build . build_version_date = date changed = True if _last_build_needs_update ( user . reporting_metadata . last_build_for_user , date ) : user . reporting_metadata . last_build_for_user = last_build changed = True return changed