예제 #1
0
def validateSetting(request, person):
    form = UserView.generate_setting_form(request, person)
    if not form.errors:
        saveSettings(person, form)
        file = request.files['image']
        if file.filename:
            if not UserManager.change_picture(person, file):
                return "Error with the picture"
        return UserView.display_settings(person, form)
    else:
        return UserView.display_settings(person, form)
예제 #2
0
def saveSettings(person, form):
    if form.password.data and not form.password.errors:
        UserManager.change_password(person, form.password.data)

    if form.image.data and not form.image.errors:
        UserManager.change_picture()

    UserManager.update_from_form(person, form)

    # UserManager.change_info(person,
    #                         form.birthdate.data,
    #                         form.sex.data,
    #                         form.weight.data,
    #                         form.height.data,
    #                         form.firstname,
    #                         form.lastname,
    # )

    return
예제 #3
0
def checkStreakController(todayDate, person, fitnessInfo):
    return UserManager.checkStreakController(todayDate=todayDate, person=person, fitnessInfo=fitnessInfo)
예제 #4
0
def validateStepsData(request, person):
    return UserManager.update_steps_ajax(person=person, form=request.form)