Skip to content

Commit

Permalink
Modified the wording to describe the penalty setting
Browse files Browse the repository at this point in the history
- There has been confusion of how the penalty settings work due to
the ambiguity of the wording.
- I have the following changes. The first penalty settings will say:
	- "From the due date to __ days late __% deducted"
- Then subsequent settings, will say:
	- "then until __ days after the due date __% deducted"
- Currently users still can't select 0% penalty.
  • Loading branch information
mwytang committed Jan 22, 2015
1 parent f863a99 commit bf5a251
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 17 deletions.
13 changes: 9 additions & 4 deletions app/views/elements/evaluations/mixeval_eval_form.ctp
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,17 @@
<?php __('Show/Hide Late Penalty Policy') ?></a>
<div id='penalty' style="display:none">
<?php if (!empty($penalty)) {
$notFirst = false;
foreach ($penalty as $day) {
$mult = ($day['Penalty']['days_late']>1) ? 's' : '';
echo $day['Penalty']['days_late'].' day'.$mult.' late: '.
$day['Penalty']['percent_penalty'].'% deduction. </br>';
$pen = $day['Penalty'];
if ($notFirst) {
echo sprintf(__('Then until %d day(s) after the due date, %s will be deducted.', true), $pen['days_late'], $pen['percent_penalty'].'%').'<br>';
} else {
echo sprintf(__('From the due date to %d days(s) late, %s will be deducted.', true), $pen['days_late'], $pen['percent_penalty'].'%').'</br>';
$notFirst = true;
}
}
printf(__('%s is deducted afterwards.', true), $penaltyFinal['Penalty']['percent_penalty'].'%');
echo sprintf(__('%s is deducted afterwards.', true), $penaltyFinal['Penalty']['percent_penalty'].'%');
} else {
echo __('No penalty is specified for this evaluation.', true);
} ?>
Expand Down
12 changes: 9 additions & 3 deletions app/views/elements/evaluations/rubric_eval_form.ctp
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,17 @@ function saveButtonVal(userId) {
<div style="text-align:left; margin-left:3em;"><a href="#" onClick="javascript:$('penalty').toggle();return false;">( <?php __('Show/Hide late penalty policy')?> )</a></div>
<div id ="penalty" style ="border:1px solid red; margin: 0.5em 0 0 3em; width: 450px; padding:0.5em; color:darkred; display:none">
<?php if (!empty($penalty)) {
$notFirst = false;
foreach ($penalty as $day) {
$mult = ($day['Penalty']['days_late']>1)?'s':'';
echo $day['Penalty']['days_late'].' day'.$mult.' late: '.$day['Penalty']['percent_penalty'].'% deduction. </br>';
$pen = $day['Penalty'];
if ($notFirst) {
echo sprintf(__('Then until %d day(s) after the due date, %s will be deducted.', true), $pen['days_late'], $pen['percent_penalty'].'%').'<br>';
} else {
echo sprintf(__('From the due date to %d days(s) late, %s will be deducted.', true), $pen['days_late'], $pen['percent_penalty'].'%').'</br>';
$notFirst = true;
}
}
echo $penaltyFinal['Penalty']['percent_penalty'].'% is deducted afterwards.';
echo sprintf(__('%s is deducted afterwards.', true), $penaltyFinal['Penalty']['percent_penalty'].'%');
} else {
echo 'No penalty is specified for this evaluation.';
}
Expand Down
9 changes: 8 additions & 1 deletion app/views/elements/evaluations/simple_eval_form.ctp
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,15 @@
<div style="text-align:left; margin-left:3em;"><a href="#" onClick="javascript:$('penalty').toggle();return false;">( <?php __('Show/Hide late penalty policy')?> )</a></div>
<div id ="penalty" style ="border:1px solid red; margin: 0.5em 0 0 3em; width: 450px; padding:0.5em; color:darkred; display:none">
<?php if (!empty($penalty)) {
$notFirst = false;
foreach ($penalty as $day) {
echo sprintf(__('%d day(s) late: %s deduction.', true), $day['Penalty']['days_late'], $day['Penalty']['percent_penalty'].'%').'</br>';
$pen = $day['Penalty'];
if ($notFirst) {
echo sprintf(__('Then until %d day(s) after the due date, %s will be deducted.', true), $pen['days_late'], $pen['percent_penalty'].'%').'<br>';
} else {
echo sprintf(__('From the due date to %d days(s) late, %s will be deducted.', true), $pen['days_late'], $pen['percent_penalty'].'%').'</br>';
$notFirst = true;
}
}
echo sprintf(__('%s is deducted afterwards.', true), $penaltyFinal['Penalty']['percent_penalty'].'%');
} else {
Expand Down
7 changes: 6 additions & 1 deletion app/views/events/add.ctp
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,9 @@ for ($i = -1; $i < $numPenalties; $i++) {
$inputs =
'<div class="penaltyInput" id="penaltyInput'.$i.'">' .
$this->Form->label("latep$i", '', array('class' => 'penaltyLabel')) .
$this->Form->label("prefix", 'Then until', array('class' => 'penaltyInLabel')) .
$this->Form->text("Penalty.$i.days_late", array('default' => $i + 1)) .
$this->Form->label('days', 'days', array('class' => 'penaltyInLabel')) .
$this->Form->label('days', 'days after the due date', array('class' => 'penaltyInLabel')) .
$this->Form->select(
"Penalty.$i.percent_penalty",
$percent,
Expand Down Expand Up @@ -211,6 +212,10 @@ function addPenaltyInputs() {
penaltyInputs = penaltyInputs.replace(/value="0"/g,
'value="' +(penaltyCount + 1)+ '"');
penaltyInputs = penaltyInputs.replace(/-1/g, penaltyCount);
if (penaltyCount == 0) {
penaltyInputs = penaltyInputs.replace("Then until", "From the due date to");
penaltyInputs = penaltyInputs.replace("days after the due date", "days late");
}
jQuery(penaltyInputs).appendTo("#penaltyInputs");

penaltyCount++;
Expand Down
14 changes: 11 additions & 3 deletions app/views/events/edit.ctp
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,9 @@ for ($i = -1; $i < $numPenalties; $i++) {
'<input type="hidden" name="required" id="required" value="eventId" />'.
$this->Form->input("Penalty.$i.id").
$this->Form->label("latep$i", '', array('class' => 'penaltyLabel')) .
$this->Form->label("prefix", 'Then until', array('class' => 'penaltyInLabel')) .
$this->Form->text("Penalty.$i.days_late", array('default' => $i + 1)) .
$this->Form->label('days', 'days', array('class' => 'penaltyInLabel')) .
$this->Form->label('days', 'days after the due date', array('class' => 'penaltyInLabel')) .
$this->Form->select(
"Penalty.$i.percent_penalty",
$percent,
Expand All @@ -185,8 +186,11 @@ for ($i = -1; $i < $numPenalties; $i++) {
if ($i < 0) {
// save for use as a template in javascript, should work in Lin/Win/Mac
$penaltyInputs = str_replace(array("\n", "\r"), "", $inputs);
}
else {
} else if ($i == 0) {
$inputs = str_replace("Then until", "From the due date to", $inputs);
$inputs = str_replace("days after the due date", "days late", $inputs);
echo $inputs;
} else {
echo $inputs;
}

Expand Down Expand Up @@ -266,6 +270,10 @@ function addPenaltyInputs() {
penaltyInputs = penaltyInputs.replace(/value="0"/g,
'value="' +(penaltyCount + 1)+ '"');
penaltyInputs = penaltyInputs.replace(/-1/g, penaltyCount);
if (penaltyCount == 0) {
penaltyInputs = penaltyInputs.replace("Then until", "From the due date to");
penaltyInputs = penaltyInputs.replace("days after the due date", "days late");
}
jQuery(penaltyInputs).appendTo("#penaltyInputs");

penaltyCount++;
Expand Down
19 changes: 14 additions & 5 deletions app/views/events/view.ctp
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,23 @@
<td>
<?php
if (!empty($event['Penalty'])) {
$notFirst = false;
foreach ($event['Penalty'] as $tmp) {
echo 'Deduct '.$tmp['percent_penalty'].'% if late by '.$tmp['days_late'].' day';
if (1 != $tmp['days_late']) {
echo 's';
if ($notFirst) {
echo 'Then until '.$tmp['days_late'].' days after the due date, ';
echo $tmp['percent_penalty'].'% will be deducted<br>';
} else {
echo 'From the due date to '.$tmp['days_late'].' day';
if (1 != $tmp['days_late'])
echo 's';
echo ' late, '.$tmp['percent_penalty'].'% will be deducted<br>';
$notFirst = true;
}
echo '<br>';
$dayslate_count = $tmp['days_late'];
}
$last = end($event['Penalty']);
echo $last['percent_penalty'].'% is deducted after '.$last['days_late'].' day';
if (1 != $last['days_late'])
echo 's';
} else {
echo 'No late penalties currently set';
}
Expand Down

0 comments on commit bf5a251

Please sign in to comment.