Skip to content

fix deprecated function get_participants_counts and fix js error#204

Closed
emily-lambrou wants to merge 5 commits intocatalyst:MOODLE_405_STABLEfrom
emily-lambrou:fix-deprecated-function
Closed

fix deprecated function get_participants_counts and fix js error#204
emily-lambrou wants to merge 5 commits intocatalyst:MOODLE_405_STABLEfrom
emily-lambrou:fix-deprecated-function

Conversation

@emily-lambrou
Copy link
Copy Markdown
Contributor

Fixes #203

@emily-lambrou
Copy link
Copy Markdown
Contributor Author

@danmarsden for your review and aprroval

@emily-lambrou emily-lambrou changed the title fix deprecated fucntion get_participants_counts and fix js error fix deprecated function get_participants_counts and fix js error Aug 28, 2025
@emily-lambrou
Copy link
Copy Markdown
Contributor Author

@danmarsden it seems that there is a warning while running the workflow

Warning: The phpcpd command is deprecated and will be removed in 5.0.0. No replacement is planned.

Please advice if there is something pending from my side.

@danmarsden
Copy link
Copy Markdown
Member

thanks - ignore the phpcpd thing - the bigger issue is the codechecker errors a bit higher in that output (which you can also run using the local_codechecker plugin locally) - most of those look to be pre-existing though so best to ignore any that relate to files not changed here - I'll drop some comments inline on the PR with some issues..

Comment thread .idea/.gitignore Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this file shouldn't be included in the PR - it's related to your IDE and not something that should sit within the plugin codebase.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

thanks, i deleted it


foreach ($rs as $user) {
if ($total === 0) {
$total = (int)$user->fullcount; // <- confirmed by your dump
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

the phpdoc comment here doesn't comply with the coding guidelines - must start with a capital letter and end with a fullstop so will throw codechecker errors - I'd just remove the comment.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done

Comment thread classes/table/reengagement_participants.php
}
}


Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this added carriage return will throw coding guideline errors as there are two empty lines/carriage returns.

Comment thread view.php
$options->noteStateNames = note_get_state_names();
}
echo '</form>';
$PAGE->requires->js_call_amd('core_user/participants', 'init', [$options]);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

is the $options array used anymore? - if not we should be deleting/clearing it properly above?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good point — the only other use of $options was setting noteStateNames (via note_get_state_names()). That was only ever consumed by the AMD init call. Since we’ve replaced the AMD args with a trimmed $jsoptions object, the noteStateNames assignment is now unused too.

So yes, it’s safe to delete the $options->noteStateNames line along with the old $options block. If we ever need those values in JS again, we can add them explicitly to $jsoptions.

Delete .idea/.gitignore
delete the unnecessary variable for options
@emily-lambrou
Copy link
Copy Markdown
Contributor Author

@danmarsden Thank you for your time and review.

Could you please have a look again in my commits/corrections and my comments?

@danmarsden
Copy link
Copy Markdown
Member

Thanks for the updated PR! - I've rebased it manually and pulled out the $options code that isn't needed anymore and merged it into the MOODLE_405_STABLE branch.

@danmarsden danmarsden closed this Sep 29, 2025
@emily-lambrou
Copy link
Copy Markdown
Contributor Author

Thanks @danmarsden !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Deprecation warning: participants_search::get_total_participants_count() in Moodle 4.5+

2 participants