GithubHelp home page GithubHelp logo

moodle-local_recompletion's Introduction

The recompletion plugin is supported and maintained by Dan Marsden

Branches

The following git branches are currently supported:

Moodle version Branch
Moodle 4.1 - 4.2 MOODLE_401_STABLE
Moodle 4.3 MOODLE_403_STABLE

This plugin adds course level settings for recompletion - clearing all course, activity completion and all other related moodle plugins data for a user based on the duration set notifying the student they need to return to the course and recomplete it.

This plugin could be used to facilitate annual re-certification.

The following information is cleared from the course during recompletion:

  • All activity grades cleared (and saved to standard grade history tables.)
  • All activity completion and course completion flags removed. (with the option to archive this information)

The following activities have extra support:

  1. Quiz You can choose to delete all existing quiz attempt data with the option to archive the information or, you can keep the existing attempts and give the student the ability to add new attempts.

  2. SCORM You can choose to delete all existing SCORM attempt data with the option to archive the information.

  3. Assignment You can choose to give the student another attempt (if the assignment is configured to allow reopening and the maximum number of attempts has not been reached.

If a user has already completed the course, and a teacher performs a grading action on an assignment, you can choose to have the course completion date updated at the same time.

Other plugins that store user data will have the activity completion data, and all related data reset, but may require manual intervention as they are not yet supported fully. Get in touch privately if you would like to fund support for other activities with user data.

For more documentation on this plugin please see: https://github.com/danmarsden/moodle-local_recompletion/wiki

moodle-local_recompletion's People

Contributors

abias avatar adamrobertbacon avatar aduranterres avatar alexmorrisnz avatar anieminen avatar danielneis avatar danmarsden avatar dmitriim avatar ewallah avatar glepod avatar golenkovm avatar guillogo avatar joshwillcock avatar keevan avatar lukascelinak avatar luukverhoeven avatar mhughes2k avatar micaherne avatar mixedfruitjuice avatar nicklambellgch avatar peterburnett avatar usqfowlerj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

moodle-local_recompletion's Issues

Quiz user overrides not reset

We have some courses which use local_recompletion where learners have a limited number of attempts on a quiz and are then required to speak to their educator who may choose to give them extra attempts.

When Recompletion is engaged, all quiz attempts are deleted but the user overrides remain, so instead of getting the x attempts they should get getting, they get x+n.

While running the cron getting error

I have scheduled the all the cron's and everything successfully completed for the past days, but now a days having issue with the recompletion cron, please look on the below content that i taken from the cron log file(First its printed the task completed and then task failed printing)

Can you please help me to find out the issue, because of this other crons also not running.

Execute scheduled task: Check for users that need to recomplete (local_recompletion\task\check_recompletion)
... started 22:30:44. Current memory use 49.7MB.
... used 112 dbqueries
... used 3164.0160620213 seconds
Scheduled task complete: Check for users that need to recomplete (local_recompletion\task\check_recompletion)
... used 113 dbqueries
... used 3164.0176432133 seconds
Scheduled task failed: Check for users that need to recomplete (local_recompletion\task\check_recompletion),Error reading from database
!!! Error reading from database !!!

Additional Attempts not possible beyond 10 attempts.

Due to how Attempts Allowed are managed in Moodle Quiz Activity Core (1-10 or unlimited), this plugin doesn't issue additional attempts upon recompletion processing if the users' total attempts > 10.

Appreciate any fix or workaround.

Add missing strings

Hi Dan,

Some missing strings are causing unit tests fail:

There was 1 failure:

1) core_privacy\privacy\provider_test::test_metadata_provider with data set "local_recompletion" ('local_recompletion', 'local_recompletion\privacy\provider')
Expectation failed, debugging() was triggered.
Debugging: Invalid get_string() identifier: 'privacy:metadata:local_recompletion_cha' or component 'local_recompletion'. Perhaps you are missing $string['privacy:metadata:local_recompletion_cha'] = ''; in /siteroot/local/recompletion/lang/en/local_recompletion.php?
* line 356 of /lib/classes/string_manager_standard.php: call to debugging()
* line 7419 of /lib/moodlelib.php: call to core_string_manager_standard->get_string()
* line 152 of /privacy/tests/privacy/provider_test.php: call to get_string()
* line 1548 of /vendor/phpunit/phpunit/src/Framework/TestCase.php: call to core_privacy\privacy\provider_test->test_metadata_provider()
* line 1154 of /vendor/phpunit/phpunit/src/Framework/TestCase.php: call to PHPUnit\Framework\TestCase->runTest()
* line 80 of /lib/phpunit/classes/advanced_testcase.php: call to PHPUnit\Framework\TestCase->runBare()
* line 728 of /vendor/phpunit/phpunit/src/Framework/TestResult.php: call to advanced_testcase->runBare()
* line 904 of /vendor/phpunit/phpunit/src/Framework/TestCase.php: call to PHPUnit\Framework\TestResult->run()
* line 675 of /vendor/phpunit/phpunit/src/Framework/TestSuite.php: call to PHPUnit\Framework\TestCase->run()
* line 675 of /vendor/phpunit/phpunit/src/Framework/TestSuite.php: call to PHPUnit\Framework\TestSuite->run()
* line 661 of /vendor/phpunit/phpunit/src/TextUI/TestRunner.php: call to PHPUnit\Framework\TestSuite->run()
* line 144 of /vendor/phpunit/phpunit/src/TextUI/Command.php: call to PHPUnit\TextUI\TestRunner->run()
* line 97 of /vendor/phpunit/phpunit/src/TextUI/Command.php: call to PHPUnit\TextUI\Command->run()
* line 97 of phpvfscomposer:///vendor/phpunit/phpunit/phpunit: call to PHPUnit\TextUI\Command::main()
* line 118 of /vendor/bin/phpunit: call to include()

Failed asserting that 1 matches expected 0.

/siteroot/lib/phpunit/classes/advanced_testcase.php:398
/siteroot/privacy/tests/privacy/provider_test.php:153
/siteroot/lib/phpunit/classes/advanced_testcase.php:80
phpvfscomposer:///siteroot/vendor/phpunit/phpunit/phpunit:97

FAILURES!
Tests: 1497, Assertions: 11670, Failures: 1.

Bugs using plugin whit oracle database

Into table local_recompletion_config fild "value" is translated to "clob" on oracle database due to using "text" in install.xml as type for that colum. Having value as clob, breaks the query at the biginning execute () function of scheduled task.

Similar issue on query:
SELECT DISTINCT a. *
FROM {assign} a
JOIN {assign_submission} s ON a.id = s.assignment
WHERE a.course =? AND s.userid =?
of rest_assign funciton. Having "distinct" into select breaks the query due to a clob field in assign table. Maybe using only a.id as select fix this problm considering that "id" is the only field used in that pice of code.

option to delete user activity in modules or allow extra attempts

should we provide the ability to delete content within specific modules? - deleting quiz attempts/assignments/SCORM attempts.

my current thoughts are "no we shouldn't" but maybe we could add support to allow the number of allowed attempts to be bumped... giving students the ability to submit a new attempt to some activities that support it.

Other plugins impelmetnation

Hi, i have solution for archives,
if would not be beter to storage all archived data in one table, as json data, for example:

quiz->idnumber= array(quiz_attempts->idnumber= array("quiz_attempt_row"),)
ad so,
scheme
module->id=array_of_archived_tables(module_table=table_row);

Issued badges removing and archiving

Hi,
i have one question, about issued badges,
when is completion cleared, i think it would be fine for removing issued badges on that completion too.

I can make implementation for this.

CourseRecompletion in course with multiple LTI Tools

I jumped into an issue with the CourseRecompletion when used in a course with multiple LTI Tools. It did not seem to save data in the local_recompletion_ltia and did not clean the finalgrade in the enrol_lti table.

I have asked @luukverhoeven to take a look at it and he fixed the issue and will send in a push request.
It would be great if this could be checked/accepted as soon as possible.

Gemma

Recompletion based on last date or option to set a calendar period as the recompilation timeframe.

Hello,

We have a situation where a course needs to be completed yearly during a set period of time regardless of when the course was last completed. This situation comes up when a new hire is trained outside of the required timeframe during their first calendar year, but the following calendar year they need to complete the course during the set period of time, which could be just a month from the last time.

Is this in the roadmap, or is there a way to accomplish this that I am not seeing?

We are running Moodle 3.9.6 and plugin version 2021092000.

Regards,
Ron

Fatal error in task execution

Hi,

I've noticed a fatal error while testing the plugin and running cron:

Execute scheduled task: Check for users that need to recomplete (local_recompletion\task\check_recompletion)
PHP Fatal error: Class 'completion_info' not found in /var/www/moodle/local/recompletion/classes/task/check_recompletion.php on line 52

reset clears all assignment and course data

Hi Dan and team,

Thanks for your work developing this plugin! I'm not sure if this is intended behaviour, but I couldn't recognise anything in the documentation.

Once an expiration triggers a course reset, all course and assignment data for the student is cleared - assignment status, assignment grade, all dates, file submissions, comments, feedback files, feedback notes, final grade, completion status...

The activity settings which appear to cause this are:

Activity Settings: Submission settings: Additional Attempts: Automatic until pass
Activity Settings: Submission settings: Maximum Attempts: Unlimited

I was finally able to retain data by changing
Additional Attempts: Manual
Maximum Attempts: 1

Assignments history keeps reapearing for submitions even if deleted on recompletion.

There are a couple of major issues (bugs) that I have detected.

  1. All Assignments history keeps reappearing for submissions even if deleted on recompletion.
  2. It then then sends out multiple email messages requesting the student to completes the assignment one for each old previous attempt making the plugin virtually unusable.

This even happens if you delete all submissions one a new submission is reset the old ones reappear as though they are being restored. It would not be all bad if it did not send out multiple emails to the learners.

I’m using Moodle 4.2 and the latest version of the plugin.

image

add Years Months and Weeks to duration units

we have a scenario, the courses need to recomplete after two years, on the same date. I found the bigest duration unit option is weeks, I think we can add years and months to the unit options. I have had my own implement, I will send a pull request to you.

Setup date for all users in a course

Dan, this is wonderful plugin. I wonder maybe there is a way to update the course completion date for all user in one step. Do you have any plan to introduce this feature?

**new feature** in bulk resett all completion

Right now you can do a bulk action change completion date for selected users -it would be nice to also have the option for a bulk action ** reset all completion for selected users** on the same page (/local/recomplation/participants (modify course completion dates)

Feature request: LTI provider

We love the way this plugin is working and how we can use it in courses.
And now we want to implement it within our LTI provider courses in Moodle 3.5, 3.8 and 3.9.

I did a test to see if it would work and if not what is needed.
And the even though the Course Recompletion plugin nicely removes the grade, the LTI provider saves in a separated table "enrol_lti_user" the last grade send.

Due to this, whenever a new grade is the same as in the last_grade in the Enrol_lti_User table de cron job LTI Grade sync, skips the grade and is not sending it towards the LTI consumer.
In my test, every higher and lower grade is being send, it just refuses to send the “same grade”.

I understand why this is build in from an LTI Provider point of view, and it does not seem to be logically to make a change there.
But for re completing a Moodle course using the LTI provider tool, we will need it to work.

To make it work, I would suggest to build in an new (extra) functionality in the Course Recompletion plugin similar to the Quiz, SCORM and Assignement options for the LTI Provider (Moodle standard!) in the ADVANCED section.

The setting would be similar to the other settings:

LTI Provider last grade send:

  • Do nothing (last grade stays in the table enrol_lti_user)

  • Delete last grade send (last grade in table enrol_lti_user will be removed)

  • Archive last grade send (last grade will be removed in table enrol_lti_user, but will be logged in local_recompletion_ltia (or table name that seems fitting to the developer) in a similar way as the Quiz module : LTI TOOL ID, Moodle USER ID, lastaccess, modified, course)

allow more flexibility on which activities to recomplete within a course.

Allow the teacher to specify which activities should be reset - an example of this use could allow for the initial
course completion to use a specific certificate activity, but subsequent completions could use a different
instance of the certificate activity - there could also be activities within the course that do not requite re-completion.

Reflect the plugin status in the maturity level

The plugin description reads "WARNING: This is currently proof of concept code - it should not be used in production!" yet the version.php has declared

$plugin->maturity  = MATURITY_STABLE;

Maybe it would help to have the maturity set to ALPHA so that it raises a warning in the plugin installer.

html placeholders are not working in the Notification body - Release 2023040300 (2023040301)

We updated our LMS to release 2023040300 (2023040301).
Our notifications no longer behave as expected.
The placeholders within the body are not adding the expected values. The subject line is working as expected.
The body displays correctly until the reveal html is selected.
When I displayed the body in html the -> was replaced with >
I have tried multiple times to replace the > with -> and save the notification.
When I open the notification in html it is displayed with the > values.
This affects 49 courses to hundreds of students.

Support for Choice activity

We have quiz that has a restriction configured that requires 2 choice activities to be complete before the quiz can be accessed. (The choice activities are there for the purpose of the student agreeing to a policy and confirming they've read the instructions.)

What we're experiencing is that the recompletion plugin is not resetting the activity completion for the purpose of the restriction. The student visits the course for their second enrollment and the 2 choice activities still appear to the student as having been complete, however, in the activity completion report they do not have check marks for those activities.

The result is that the student cannot complete the activity again, but also the quiz will not allow them access because the quiz doesn't consider the activities complete to satisfy the restriction requirement.

add support for certificate plugins.

I read in many forum threads about recompletion, that resetting the certificates with a recompletion was something asked for a lot and planned to implement. In the docs it is not mentioned at all, though.

Is there a way or a workaround to issue new certificates (coursecertificate or customcertificate) when the course is reset for a student and the course or an activity is completed again?

As I found, it seems that coursecertificate does not issue a new certificate if one exists already, even if it is expired as a consequence of its own settings.

With badges I understand, that badges are something earned and built upon, but certificates are a different thing.

Is there a way to solve this?

(Usually the recommendations are that one could just set up a new certificate, but that only works if entire cohorts - in the original meaning of the word - start the course together and not at different times. Which is exactly why this plugin exists, as I understand...)

allow thirdparty emails

It should be possible to notifiy other people (teachers/admins etc) when a user recompletion event occurs.

should allow e-mails to be configured.

debugging notices in 3.9

The latest changes use some deprecated Apis that need to be updated for 3.9 so it doesn't throw debugging notices.

core_user_renderer->unified_filter() is deprecated. Please use participants_filter() instead.
line 124 of /user/renderer.php: call to debugging()
line 205 of /local/recompletion/participants.php: call to core_user_renderer->unified_filter()
core_user\output\unified_filter class is deprecated. Please use \core\table\participants_search::class with table filtersets instead.
line 64 of /user/classes/output/unified_filter.php: call to debugging()
line 259 of /user/renderer.php: call to core_user\output\unified_filter->__construct()
line 205 of /local/recompletion/participants.php: call to core_user_renderer->unified_filter()

also some copied api functions that we don't need to maintain in the code related to the participants table stuff.

M40 Local Recompletion does not show "run now" in Tasks

Version: 20220324002022032400
Moodle: 4.0.2
PHP 7.4

Site administration > Server > Scheduled Tasks

In previous versions of Moodle we could click on "Run now" if properly configured in Moodle.
The run now options has dissapeared in M4.0

image

The local_recompletion_ltia is not covered with metadata providers

Hi,

It seems that local_recompletion_ltia table isn't listed in privacy provider get_metadata():

There was 1 failure:

1) provider_testcase::test_table_coverage
The following tables with user fields must be covered with metadata providers: 
  - local_recompletion_ltia (userid)

/siteroot/privacy/tests/provider_test.php:327
/siteroot/lib/phpunit/classes/advanced_testcase.php:80

To re-run:
 vendor/bin/phpunit "provider_testcase" privacy/tests/provider_test.php

No Archive completion data stored in DB

I recently discovered that the recompletion tables are empty even though I'm forcing the archival of completion data in the plugin's global settings. I know that we've had several completion resets happen, both in my testing and actual students, so that confirms the plugin is running. I also have the scheduled task set to run every 5 minutes while I'm testing its function.

I'm attaching a screenshot of my global plugin settings.

Screen Shot 2022-12-22 at 12 23 48 PM

MSSQL fails to cast values to integer - causing Scheduled Task to fail.

Hi - hoping you can assist with this issue.

Recompletion scheduled task keeps failing with the error message 'The conversion of the nvarchar value '8639913600' overflowed an int column' - see attached log.

Initially ran ok but started failing once courses started using the option.

Running on Windows stack
Moodle 3.10.4 (Build: 20210510)
PHP 7.2.26
MSSQL 11.00.7493
local_recompletion | 2.02020122300

local_recompletion_task_check_recompletion-129064.log
Server_Environment_2021-06-08_10-20-18

Thanks - Phil

"Grade Status" & "Grade" columns do not reset: Grade or View all Assignment submissions

Example: Using a single-activity course with an assignment

SETUP & GRADE

  1. Enable recompletion, set course duration, delete grades for user selected
  2. Go to the Assignment: "View all submissions" or "Grade"
  3. Grade student with passing grade (I used a C/NYC scale)

RESET
5. Edit course completion date for that student, choose a past date longer than the course duration from step 1.
6. Confirm grades have been deleted.

VIEW ISSUE
8. Navigate back to Assignment: "View all submissions" or "Grade"
9. View all submissions: Grade Status is "Graded", and the pass grade is still showing (not reset)
10. Grade: Grade status is "Graded", and the pass grade is still showing (not reset). In addition, directly underneath says "not graded"

incorrect status_grade

Changing course recompletion settings for plugins (advanced section) doesn't appear to work

I feel like I must be missing something here, but I've reproduced this issue on two Moodle sites. It looks like, when making changes to the course-level recompletion settings for specific plugins (Course > Course Recompletion > Advanced), the changes are not actually saved in the database.

  • For example, if I go to this page and set the form as below:
    image
  • When I hit save and come back to the page, the settings are not saved:
    image

This seems to be because of the way the plugin tries to set these settings in recompletion.php. The code gets a list of the supported plugins, and then iterates over that list trying to grab the relevant settings from the form data using the plugin name. The problem is that the list returned by local_recompletion_get_supported_plugins() does not match the plugin names given by the form data. Here's an example of the form data that might be passed:

{
  ["enable"]=>
  string(1) "1"
  ["recompletionduration"]=>
  int(0)
  ["mform_isexpanded_id_emailheader"]=>
  int(0)
  ["recompletionemailsubject"]=>
  string(0) ""
  ["recompletionemailbody"]=>
  string(0) ""
  ["mform_isexpanded_id_advancedheader"]=>
  int(1)
  ["deletegradedata"]=>
  string(1) "1"
  ["assign"]=>
  string(1) "0"
  ["questionnaire"]=>
  string(1) "1"
  ["quiz"]=>
  string(1) "1"
  ["scorm"]=>
  string(1) "1"
  ["submitbutton"]=>
  string(12) "Save changes"
  ["course"]=>
  int(13)
  ["forcearchive"]=>
  int(0)
}

And here's the setnames variable that gets built from the above mentioned function:

{
  [0]=>
  string(6) "enable"
  [1]=>
  string(20) "recompletionduration"
  [2]=>
  string(15) "deletegradedata"
  [3]=>
  string(21) "archivecompletiondata"
  [4]=>
  string(23) "recompletionemailenable"
  [5]=>
  string(24) "recompletionemailsubject"
  [6]=>
  string(21) "recompletionemailbody"
  [7]=>
  string(11) "assignevent"
  [8]=>
  string(10) "mod_assign"
  [9]=>
  string(17) "archivemod_assign"
  [10]=>
  string(7) "mod_lti"
  [11]=>
  string(14) "archivemod_lti"
  [12]=>
  string(17) "mod_questionnaire"
  [13]=>
  string(24) "archivemod_questionnaire"
  [14]=>
  string(8) "mod_quiz"
  [15]=>
  string(15) "archivemod_quiz"
  [16]=>
  string(9) "mod_scorm"
  [17]=>
  string(16) "archivemod_scorm"
}

As you can see, the plugin names don't match. The plugin will try to get a value by doing $data->$name -- for example, $data->mod_quiz -- but this doesn't exist; instead, it would need to be $data->quiz.

Database error selecting 'Modify course completion dates'

Version 2022032400

To reproduce...

  • Click the 'Modify course completion dates' column
  • Try to sort by the 'Course completion' column. This comes up in a pop up

The page can no longer be displayed. I'm guessing that clearing a cache may fix it but I haven't tried

Debug info: Unknown column 'coursecompletion' in 'order clause'
SELECT COALESCE(ul.timeaccess, 0) AS lastaccess , u.id, u.username, u.idnumber, u.email, u.picture, u.firstname, u.lastname, u.firstnamephonetic, u.lastnamephonetic, u.middlename, u.alternatename, u.imagealt, ctx.id AS ctxid, ctx.path AS ctxpath, ctx.depth AS ctxdepth, ctx.contextlevel AS ctxlevel, ctx.instanceid AS ctxinstance, ctx.locked AS ctxlocked
FROM (SELECT DISTINCT udistinct.id
FROM mdl_user udistinct
JOIN mdl_user_enrolments ue ON ue.userid = udistinct.id
JOIN mdl_enrol e ON e.id = ue.enrolid
AND e.courseid = ?
WHERE udistinct.deleted = 0 AND udistinct.id <> ?
) targetusers
JOIN mdl_user u ON u.id = targetusers.id
LEFT JOIN mdl_user_lastaccess ul ON (ul.userid = u.id AND ul.courseid = ?)
LEFT JOIN mdl_context ctx ON (ctx.instanceid = u.id AND ctx.contextlevel = ?)

ORDER BY coursecompletion ASC, lastname ASC LIMIT 0, 20
-- line 117 of /user/classes/table/participants_search.php: call to mysqli_native_moodle_database->get_recordset_sql()
-- line 421 of /user/classes/table/participants.php: call to core_user\table\participants_search->get_participants()
-- line 162 of /local/recompletion/classes/table/participants.php: call to core_user\table\participants->query_db()
-- line 174 of /local/recompletion/participants.php: call to local_recompletion\table\participants->out()
[array (
0 => '8283',
1 => '1',
2 => '8283',
3 => 30,
)]

*new feature* Course Completion Reset period per group

We run courses with serveral groups, it would be nice if we could set a Course Completion Reset Period per group.
The message and what to reset does not change.

@danmarsden if you think this is a valid request, then - if you don't mind - I can discuss with the team to create the change code. I am just not sure if:

  1. There should be a site admin setting to activate this feature, or that we just look at "are groups being used".
  2. I am thinking very simple in a 'line' for each group where you can set period. But I can imagine that people might want to do this similar as with the Restrict Access but it feels 'overcomplicated' - what are your thoughts on this.

and maybe I am missing other things to concider.

  • Gemma

Sorting CourseCompletion

Hi
When I go to "Modify Course Completion Dates" and I click with my mouse on the colum "Course completion" (last column) for sorting.

I receive get the following error messages

Moodle 3.9
Versions plugin: 2021092000 (2021092000)

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.