Skip to content

Commit

Permalink
codestyle fix
Browse files Browse the repository at this point in the history
  • Loading branch information
irinahpe committed Aug 6, 2024
1 parent 5df8598 commit e532301
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions classes/completion/custom_completion.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function get_state(string $rule): int {
$course = $this->cm->get_course();
$instance = $this->cm->instance;

if (!$ratingallocaterecord= $DB->get_record('ratingallocate', ['id' => $instance])) {
if (!$ratingallocaterecord = $DB->get_record('ratingallocate', ['id' => $instance])) {
throw new \moodle_exception('Unable to find ratingallocate instance with id ' . $instance);
}

Expand All @@ -60,19 +60,8 @@ public function get_state(string $rule): int {

if ($rule == 'completionvote') {
$status = count($ratingallocate->get_rating_data_for_user($userid)) > 0;
/*
$sql = "SELECT * FROM {ratingallocate_ratings} r INNER JOIN {ratingallocate_choices} c on r.choiceid=c.id " .
"WHERE r.userid= :userid AND c.ratingallocateid= :ratingallocateid";
$votesofuser = $DB->get_records_sql($sql, ['userid' => $userid, 'ratingallocateid' => $ratingallocateid]);
$status = count($votesofuser) > 0;
*/
} else if ($rule == 'completionallocation') {
$status = count($ratingallocate->get_allocations_for_user($userid)) > 0;
/*
$sql = "SELECT * FROM {ratingallocate_allocations} WHERE userid= :userid AND ratingallocateid= :ratingallocateid";
$allocationsofuser = $DB->get_records_sql($sql, ['userid' => $userid, 'ratingallocateid' => $ratingallocateid]);
$status = count($allocationsofuser) > 0;
*/
}

return $status ? COMPLETION_COMPLETE : COMPLETION_INCOMPLETE;
Expand Down

0 comments on commit e532301

Please sign in to comment.