ewallah / moodle-availability_relativedate

Relative dates in Moodle
https://moodle.org/plugins/availability_relativedate
GNU General Public License v3.0
8 stars 7 forks source link

Decipher course backup #18

Closed davidpesce closed 1 year ago

davidpesce commented 1 year ago

I just stumbled on this plugin, and it seems incredible. Thank you for creating it!

I'm having to do some manipulation at the course backup level and wondered if there was a legend that explains the individual values within the availabilityjson (in the course backup)?

{"type":"relativedate","n":"2","d":"2","s":"6","m":""}

Full here: {"op":"&","c":[{"type":"relativedate","n":"1","d":"0","s":"1","m":""}],"showc":[true]}

I attempted (see below), but would be curious about the definitive answer.

n = relativenumber? 2 = 2 units? d = relativedwn? 2 = days s = relative start 6 = Before course start date m = ? "" = ?

davidpesce commented 1 year ago

Sorry to bug. Any thoughts on this?

ewallah commented 1 year ago

Sorry, but I had the impression I already answered this. Anyhow everything is documented in the code

n => relativenumber
d => relativedwm
     * 0 => minutes
     * 1 => hours
     * 2 => days
     * 3 => weeks
     * 4 => months
s => relativestart
     * 1 => After Course start date
     * 2 => Before Course end date
     * 3 => After User enrolment date
     * 4 => After Enrolment method end date
     * 5 => After Course End date
     * 6 => Before Course start date
     * 7 => After completion of an activity
m =>relativecoursemodule

So {"type":"relativedate","n":"2","d":"2","s":"6","m":""} reads as 2 days before course start date and {"type":"relativedate","n":"1","d":"0","s":"1","m":""} reads as 1 minute after course start date

R

davidpesce commented 1 year ago

Thank you! Exactly what I need.