On Wednesday, March 12, 2014 9:39:16 AM UTC-4:30, orchid barua wrote:
>
> The view portion has this:
> def question_check_anon(request, quiz):
>     """
>     check if a question is correct, adds to score if needed and return the 
> previous questions details
>     """
>     quiz_id = str(quiz.id)
>     guess = request.GET['guess']
>     answer = Answer.objects.get(id=guess)
>     question = answer.question  #  the id of the question
>     
>     if answer.correct == True:
>         outcome = "correct"
>         score = quiz_id + "_score"
>         current = request.session[score]
>         current = int(current) + 1
>         request.session[score] = current  #  add 1 to the score
>         anon_session_score(request, 1, 1)
>     else:
>         outcome = "incorrect"
>         anon_session_score(request, 0, 1)
>         
>     if quiz.answers_at_end != True:  #  display answer after each question
>         return {'previous_answer': answer, 'previous_outcome': outcome, 
> 'previous_question': question, }
>     else:  #  display all answers at end
>         return {}
> Related template :
> <form action="/{{ quiz.url }}/take/" method="get">
>
>     
> <table class="table table-hover table-bordered" id="answerchoice">
> <tbody>
>
>
> {% for answer in answers %}
>     <tr>
>         <td>
>                 <label>
>                     <input type="radio" name="guess" value="{{ answer.id}}" 
> class="form-radio">
>                     {{ answer.content }}
>                 </label>
>         </td>
>     </tr>
> {% endfor %}
> </form>
> </tbody>
> </table>
> <input type="submit" value="Check" class="btn btn-large btn-block 
> btn-warning" >
>
> I guess I will change the template to
>
> <label>
>           <input type="checkbox" name="guess" value="{{ answer.id }}" 
> class="form-radio"> True <input type="checkbox" name="guess" value="{{ 
> answer.id }}" class="form-radio"> False ||
>         
>            {{ answer.content }}
>  </label>
>
> and view to:
>     if answer.correct == True:
>         outcome = "correct"
>         score = quiz_id + "_score"
>         current = request.session[score]
>         current = int(current) + 1
>         request.session[score] = current  #  add 1 to the score
>         anon_session_score(request, 1, 1)
>     elif answer.incorrect == True:
>         outcome = "correct"
>         score = quiz_id + "_score"
>         current = request.session[score]
>         current = int(current) + 1
>         request.session[score] = current
>         anon_session_score(request, 1, 1)    
>     else:
>         outcome = "incorrect"
>         anon_session_score(request, 0, 1)
>
>
> but the result is not what I expected.
>
>
>
> On Monday, March 10, 2014 12:04:35 PM UTC+6, orchid barua wrote:
>>
>> I want to modify the django-quiz application.
>> https://github.com/tomwalker/django_quiz
>>
>> The quesiton will be a multiple true false type. Each question will have 
>> 5 stem, each will be tested for true/false. Each will carry partial marks 
>> eg. 1 will be awarded for a correct ans. And there will be a system for 
>> penalty eg. deduct 0.5 marks for a wrong answer of a stem. 
>>
> Hello

For what I understand you only like to apply a penalty of 0.5 to incorrect 
answers, so, does calling anon_session_score(request, -0.5, 1) works for 
this?

Yours,
Camilo 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/eab0ea31-4e94-470a-9800-1ce782d819df%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to