Skip to content
This repository has been archived by the owner on May 10, 2022. It is now read-only.

lml/ost#346: Make feedback penalty configurable. #350

Merged
merged 3 commits into from
Jun 29, 2014

Conversation

navilan
Copy link
Contributor

@navilan navilan commented Jun 12, 2014

  • Add feedback penalty field to the settings store.
  • Add feedback penalty to show and edit views.
  • Add JS to show / hide penalty based on feedback required.
  • Add help file for @kjdav with some help text.
  • Ensure score detail page does not need any updates.

@navilan
Copy link
Contributor Author

navilan commented Jun 12, 2014

@kjdav - the help file is _feedback_viewing_penalty.html.erb

- Add feedback penalty field to the settings store.
- Add feedback penalty to show and edit views.
- Add JS to show / hide penalty based on feedback required.
- Add help file for @kjdav with some help text.
- Ensure score detail page does not need any updates.
<%= form.check_box :is_feedback_required_for_credit %>
Students must view the feedback to get credit for the problems.
</div>
<div class="field feedback-viewing-penalty"
<% if not feedback_condition.is_feedback_required_for_credit %>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might need some JS to display this when the checkbox is clicked.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nevermind... unobtrusive JS always gets me.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ha ha ha - yeah. Good thing is, code like this would soon be history :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The norm in the baseline is to use ! instead of not. Here you can also say

unless feedback_condition.is_feedback_required_for_credit

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. Will fix.

- Stop getting confused between JS and CS.
- Fix copyrights on changed files.
@@ -303,7 +315,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 ? 0 : 1)
student_exercise.update_feedback_credit_multiplier!(is_feedback_required_for_credit ? feedback_viewing_penalty/100 : 1)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since feedback_viewing_penalty is an integer, dividing by another integer will do integer division, e.g. 12/100 == 0. To force the division we expect, divide the attribute by a float: feedback_viewing_penalty/100.0.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops. Its like I am learning to code again ;) Thanks. Will fix.

- Use `unless` instead of `if not`
- Use floating point division.
jpslav added a commit that referenced this pull request Jun 29, 2014
@jpslav jpslav merged commit a6e06e1 into lml:master Jun 29, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants