2015-11-24 05:02:46 +01:00
|
|
|
|
2016-06-02 21:43:41 +02:00
|
|
|
from django.http import HttpRequest, HttpResponse
|
2015-11-24 05:02:46 +01:00
|
|
|
|
2017-10-09 22:55:38 +02:00
|
|
|
from zerver.decorator import has_request_variables, REQ
|
2017-10-04 21:37:37 +02:00
|
|
|
from zerver.lib.response import json_success
|
2015-11-24 05:02:46 +01:00
|
|
|
from zerver.lib.validator import check_string
|
|
|
|
from zerver.models import UserProfile
|
|
|
|
|
|
|
|
@has_request_variables
|
2017-10-09 22:55:38 +02:00
|
|
|
def set_tutorial_status(request, user_profile,
|
|
|
|
status=REQ(validator=check_string)):
|
2016-06-02 21:43:41 +02:00
|
|
|
# type: (HttpRequest, UserProfile, str) -> HttpResponse
|
2015-11-24 05:02:46 +01:00
|
|
|
if status == 'started':
|
|
|
|
user_profile.tutorial_status = UserProfile.TUTORIAL_STARTED
|
|
|
|
elif status == 'finished':
|
|
|
|
user_profile.tutorial_status = UserProfile.TUTORIAL_FINISHED
|
|
|
|
user_profile.save(update_fields=["tutorial_status"])
|
|
|
|
|
|
|
|
return json_success()
|