File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -137,18 +137,23 @@ def _create_tast_obj_result(
137137 correct_answer : bool = True ,
138138 ):
139139 """
140- Формирование результата.
141- Если навык Task бесплатный, то без поинтов.
140+ Формирование результата выполнения задачи:
141+ - 80 / количество задач в навыке
142+ - 0 баллов, если задача бесплатная
142143 """
143144 if self .request_task_object .task .free_access :
144- point_type = TypeQuestionPoints .QUESTION_WO_POINTS
145+ points = 0
146+ else :
147+ skill = self .request_task_object .task .skill
148+ tasks_count = skill .tasks .count () or 1 # защита от деления на 0
149+ points = round (80 / tasks_count )
145150
146- TaskObjUserResult .objects .create_user_result (
147- self .request_task_object .id ,
148- self .request_profile_id ,
149- point_type ,
151+ TaskObjUserResult .objects .create (
152+ task_object = self .request_task_object ,
153+ user_profile_id = self .request_profile_id ,
150154 text = text ,
151155 correct_answer = correct_answer ,
156+ points_gained = points ,
152157 )
153158
154159 def _delete_self_counter (self ):
You can’t perform that action at this time.
0 commit comments