Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

forcing array type before using current() #9

Open
wants to merge 1 commit into
base: UCL_2023120501
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ function turnitintooltwo_grade_item_update($turnitintooltwo, $grades = null) {

// Get the latest part, for the post date and set the default hidden value on grade item.
$lastpart = $DB->get_record('turnitintooltwo_parts', array('turnitintooltwoid' => $turnitintooltwo->id), 'max(dtpost)');
$lastpart = current($lastpart);
$lastpart = current((array)$lastpart);
$params['hidden'] = $lastpart;

// There should always be a $cm unless this is called on module creation.
Expand Down Expand Up @@ -1546,7 +1546,7 @@ function turnitintooltwo_init_browser_assignment_table($tiicourseid) {
);

if (!empty($turnitincourse)) {
$course = current($turnitincourse);
$course = current((array)$turnitincourse);
$coursedetails = turnitintooltwo_assignment::get_course_data($course->courseid, $course->course_type);
$courseid = $course->courseid;
$coursetitle = $coursedetails->fullname;
Expand Down