Non-core contributed modules

backup.php - merge grade_events_grades under grade_events in moodle.xml

Details

  • Type: Sub-task Sub-task
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Won't Fix
  • Affects Version/s: 1.8
  • Fix Version/s: 1.8
  • Component/s: Patch: Gradebook Plus
  • Labels:
    None
  • Affected Branches:
    MOODLE_18_STABLE
  • Fixed Branches:
    MOODLE_18_STABLE

Description

In order to merge the grade_events_grades and grade_events functions into a single function the backup data should all be together as one major section with subsections for grade_events and grade_events_grades with grade_event_grade information underneath of it.

Activity

Hide
Anthony Borrow added a comment -

I'm beginning to think that rather than combining the two separate functions I created (one for grade_events and one for grade_events_grades) into a single function that instead I may want to nest both of these functions in the existing gradebook function. Having the functions separate helped me to learn how things work but logistically it makes sense to me to have:

<gradebook>
<grade_events>
<grade_event>
<grade_event_grades>
</grade_event_grades>
</grade_event>
<grade_events>
</gradebook>

in the moodle.xml file; however, if someone were to try to restore a Moodle 1.8 GBPv2 course to a Moodle 1.9 installation I wonder if it would be better to have so that the grade events are kept separate from the gradebook as follows:

<gradebook></gradebook>
<grade_events>
<grade_event>
<grade_event_grades>
<grade_event_grade>
</grade_event_grade>
</grade_event_grades>
</grade_event>
</grade_events>

My working patch currently uses two functions helped me to work on building up the smaller pieces and uses:

<gradebook>
</gradebook>
<grade_events>
<grade_event></grade_event>
</grade_events>
<grade_events_grades>
<grade_event_grade></grade_event_grade>
</grade_events_grades>

As a result, I'm torn between option 1 which is IMO the purest patch that might not import well beyond 1.8 installations with GBPv2 (-1), option 2 which seems to provide the best of both worlds, and option 3 which is functional even if not the most efficient way of doing things at least it works (right now). I think for now, I'm going to go with what is working, commit it and then work on improving it. I'm open to comments, suggestions, preferences, etc. Peace - Anthony

Show
Anthony Borrow added a comment - I'm beginning to think that rather than combining the two separate functions I created (one for grade_events and one for grade_events_grades) into a single function that instead I may want to nest both of these functions in the existing gradebook function. Having the functions separate helped me to learn how things work but logistically it makes sense to me to have: <gradebook> <grade_events> <grade_event> <grade_event_grades> </grade_event_grades> </grade_event> <grade_events> </gradebook> in the moodle.xml file; however, if someone were to try to restore a Moodle 1.8 GBPv2 course to a Moodle 1.9 installation I wonder if it would be better to have so that the grade events are kept separate from the gradebook as follows: <gradebook></gradebook> <grade_events> <grade_event> <grade_event_grades> <grade_event_grade> </grade_event_grade> </grade_event_grades> </grade_event> </grade_events> My working patch currently uses two functions helped me to work on building up the smaller pieces and uses: <gradebook> </gradebook> <grade_events> <grade_event></grade_event> </grade_events> <grade_events_grades> <grade_event_grade></grade_event_grade> </grade_events_grades> As a result, I'm torn between option 1 which is IMO the purest patch that might not import well beyond 1.8 installations with GBPv2 (-1), option 2 which seems to provide the best of both worlds, and option 3 which is functional even if not the most efficient way of doing things at least it works (right now). I think for now, I'm going to go with what is working, commit it and then work on improving it. I'm open to comments, suggestions, preferences, etc. Peace - Anthony
Hide
Eloy Lafuente (stronk7) added a comment -

Hi Anthony,

while all 3 options are fine, I really had chosen the second because:

1) It doesn't interfere with code gradebook (totally separated hack).
2) It's nested, you only need to handle one new section and don't need grade_event_grade->event recode

With the third option (that seems the one you have worked), everything is ok from a perspective of being separated from standard gradebook section, perfect, but:

1) It requires 2 new sections in the XML to be parsed and so on (not critical).
2) It requires to save each old grade_event->id and its new counterpart when inserted because in a different section, when processing grade_event_grade records you'll need to convert the old grade_event_grade->event to the new counterparts.

But any of the three options can work, for sure. It's only a matter of which one could be, theoretically, the best.

Ciao

Show
Eloy Lafuente (stronk7) added a comment - Hi Anthony, while all 3 options are fine, I really had chosen the second because: 1) It doesn't interfere with code gradebook (totally separated hack). 2) It's nested, you only need to handle one new section and don't need grade_event_grade->event recode With the third option (that seems the one you have worked), everything is ok from a perspective of being separated from standard gradebook section, perfect, but: 1) It requires 2 new sections in the XML to be parsed and so on (not critical). 2) It requires to save each old grade_event->id and its new counterpart when inserted because in a different section, when processing grade_event_grade records you'll need to convert the old grade_event_grade->event to the new counterparts. But any of the three options can work, for sure. It's only a matter of which one could be, theoretically, the best. Ciao
Hide
Anthony Borrow added a comment -

In the interest of time I am not going to do this. The current patch in HEAD is functional and hopefully now with Moodle 1.9 out GBPv2 will soon become obsolete. Peace - Anthony

Show
Anthony Borrow added a comment - In the interest of time I am not going to do this. The current patch in HEAD is functional and hopefully now with Moodle 1.9 out GBPv2 will soon become obsolete. Peace - Anthony
Hide
Anthony Borrow added a comment -

Closing all of my resolved issues. Peace - Anthony

Show
Anthony Borrow added a comment - Closing all of my resolved issues. Peace - Anthony

People

Vote (1)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: