Skip to content

Commit

Permalink
MDL-71163 mod_feedback: remove duplicate date info
Browse files Browse the repository at this point in the history
The $extradetails parameter in the constructor of the
mod_feedback\output\summary class is no longer used by any of the codes
that instantiate the class. Therefore, it is removed.
The respective template is updated as well.
  • Loading branch information
rezaies committed Apr 30, 2021
1 parent c49d99d commit a1411bb
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 32 deletions.
18 changes: 6 additions & 12 deletions mod/feedback/classes/output/summary.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,20 +46,20 @@ class summary implements renderable, templatable {
/** @var int */
protected $mygroupid;

/** @var bool */
protected $extradetails;

/**
* Constructor.
*
* @todo MDL-71494 Final deprecation of the $extradetails parameter in Moodle 4.3
* @param mod_feedback_structure $feedbackstructure
* @param int $mygroupid currently selected group
* @param bool $extradetails display additional details (time open, time closed)
* @param bool|null $extradetails Deprecated
*/
public function __construct($feedbackstructure, $mygroupid = false, $extradetails = false) {
public function __construct($feedbackstructure, $mygroupid = false, $extradetails = null) {
if (isset($extradetails)) {
debugging('The $extradetails parameter is deprecated.', DEBUG_DEVELOPER);
}
$this->feedbackstructure = $feedbackstructure;
$this->mygroupid = $mygroupid;
$this->extradetails = $extradetails;
}

/**
Expand All @@ -72,12 +72,6 @@ public function export_for_template(renderer_base $output) {
$r = new stdClass();
$r->completedcount = $this->feedbackstructure->count_completed_responses($this->mygroupid);
$r->itemscount = count($this->feedbackstructure->get_items(true));
if ($this->extradetails && ($timeopen = $this->feedbackstructure->get_feedback()->timeopen)) {
$r->timeopen = userdate($timeopen);
}
if ($this->extradetails && ($timeclose = $this->feedbackstructure->get_feedback()->timeclose)) {
$r->timeclose = userdate($timeclose);
}

return $r;
}
Expand Down
20 changes: 1 addition & 19 deletions mod/feedback/templates/summary.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@
Example context (json):
{
"completedcount" : 15,
"itemscount" : 5,
"timeopen" : "May 15, 2016"
"itemscount" : 5
}

}}
Expand All @@ -48,20 +47,3 @@
class="feedback_info">{{#str}}questions, mod_feedback{{/str}}: </span><span
class="feedback_info_value">{{itemscount}}</span>
</div>

{{#timeopen}}
<div class="feedback_info">
<span
class="feedback_info">{{#str}}feedbackopen, mod_feedback{{/str}}: </span><span
class="feedback_info_value">{{timeopen}}</span>
</div>
{{/timeopen}}

{{#timeclose}}
<div class="feedback_info">
<span
class="feedback_info">{{#str}}feedbackclose, mod_feedback{{/str}}: </span><span
class="feedback_info_value">{{timeclose}}</span>
</div>
{{/timeclose}}

3 changes: 3 additions & 0 deletions mod/feedback/upgrade.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
=== 3.11 ===
The $extradetails parameter in the constructor of the mod_feedback\output\summary class has been deprecated and is not used anymore.

=== 3.8 ===

* The following functions have been finally deprecated and can not be used anymore:
Expand Down
2 changes: 1 addition & 1 deletion mod/feedback/view.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
$mygroupid = groups_get_activity_group($cm);

echo $groupselect.'<div class="clearer">&nbsp;</div>';
$summary = new mod_feedback\output\summary($feedbackcompletion, $mygroupid, true);
$summary = new mod_feedback\output\summary($feedbackcompletion, $mygroupid);
echo $OUTPUT->render_from_template('mod_feedback/summary', $summary->export_for_template($OUTPUT));

if ($pageaftersubmit = $feedbackcompletion->page_after_submit()) {
Expand Down

0 comments on commit a1411bb

Please sign in to comment.