Skip to content

Commit

Permalink
lml#357: Disallow '0' for feedback penalty.
Browse files Browse the repository at this point in the history
- Ensure that penalty gets translated into credit when
  applied to student exercises.
  • Loading branch information
navilan committed Aug 5, 2014
1 parent f2d1b30 commit e6e7183
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/assets/javascripts/learning_conditions.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ $ () ->
feedbackPenaltyValue.val "100"
feedbackPenalty.show()
else
feedbackPenaltyValue.val "0"
feedbackPenaltyValue.val null
feedbackPenalty.hide()
2 changes: 1 addition & 1 deletion app/models/feedback_condition.rb
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ def schedule_feedback_availability_notification(student_exercise, event)

def adjust_credit(student_exercise, event)
if StudentExercise::Event::COMPLETE == event
student_exercise.update_feedback_credit_multiplier!(is_feedback_required_for_credit ? feedback_viewing_penalty/100.0 : 1)
student_exercise.update_feedback_credit_multiplier!(is_feedback_required_for_credit ? (100 - feedback_viewing_penalty)/100.0 : 1)
end

if StudentExercise::Event::FEEDBACK_VIEWED == event
Expand Down
4 changes: 2 additions & 2 deletions app/views/feedback_conditions/_form_fields.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
<% end %> >
<%= link_to_help 'feedback_viewing_penalty',
text="Penalty",
{:title => 'Penalty'} %> if a student does not view feedback (0-100%):
<%= form.number_field :feedback_viewing_penalty, in:0..100, step:1, size:3 %>
{:title => 'Penalty'} %> if a student does not view feedback (1-100%):
<%= form.number_field :feedback_viewing_penalty, in:1..100, step:1, size:3 %>
</div>
<div class="field">
<%= form.check_box :can_automatically_show_feedback %>
Expand Down

0 comments on commit e6e7183

Please sign in to comment.