Non-core contributed modules

Block to automaticall categorise uncategorised grades by month

Details

  • Type: New Feature New Feature
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 1.9
  • Fix Version/s: None
  • Component/s: Block: Catgrades
  • Labels:
    None
  • Environment:
    Developed on my LAMP system, should be universal
  • Database:
    Any
  • Affected Branches:
    MOODLE_19_STABLE

Description

Fairly ronseal really, it finds all uncategorised grades and puts them into categories for each month. It also sets aggregatesubcats=1 for the course categories so that the course total is not effected by the categorisation. It runs every 5 mins on cron, but will take quite a while first time (if you've got lots of uncategorised grades that is) but takes a negligable amount of time thereafter.

See http://moodle.org/mod/forum/discuss.php?d=113384

Issue Links

Activity

Hide
Anthony Borrow added a comment -

Mike,

Sorry for the delayed response. I finally had a chance to look at your "block" which is really not intended to function as a block. I'm thinking this may be a good case to use the /local folder. More information about what all is possible using that is available at http://docs.moodle.org/en/Development:Local_customisation. In particular, check out toward the bottom regarding the use of /loca/cron.php which I think is really what you want. Of course there are caveats to using local so that is one option.

Another option is to leave it as a "block" and have it define it's own self_test function and avoid the check of the available formats (see attached file). I noticed this because when I went to the notifications page I received an error that self_test had failed. I saw that it was failing because there were no available formats since you had all set to false.

Having the cron.php in local would raise some other challenges about how to deal with such local code in CONTRIB. I want to check with the other developers to see how we ought best handle this one.

Peace - Anthony

Show
Anthony Borrow added a comment - Mike, Sorry for the delayed response. I finally had a chance to look at your "block" which is really not intended to function as a block. I'm thinking this may be a good case to use the /local folder. More information about what all is possible using that is available at http://docs.moodle.org/en/Development:Local_customisation. In particular, check out toward the bottom regarding the use of /loca/cron.php which I think is really what you want. Of course there are caveats to using local so that is one option. Another option is to leave it as a "block" and have it define it's own self_test function and avoid the check of the available formats (see attached file). I noticed this because when I went to the notifications page I received an error that self_test had failed. I saw that it was failing because there were no available formats since you had all set to false. Having the cron.php in local would raise some other challenges about how to deal with such local code in CONTRIB. I want to check with the other developers to see how we ought best handle this one. Peace - Anthony
Hide
Anthony Borrow added a comment -

Mike - Here is a patched version of the file with it's own self_test function to avoid getting an error during install. Peace - Anthony

Show
Anthony Borrow added a comment - Mike - Here is a patched version of the file with it's own self_test function to avoid getting an error during install. Peace - Anthony
Hide
Mike Worth added a comment -

Thanks for that, I'd seen the errors but couldn't work out why (and just ignored them as it seemed to work fine).

I didn't know anything about local until I read that link, could it be better linked to other places in the docs or am I just a bit blind?

I suppose it could go in local, although this strikes me as the sort of thing that might be used more widely (potentially with options to sort on things other than month). Would being in local put some people off (especially if it needed merging with another cron.php)?

Also I've been having some problems with grade totals not refreshing properly and showing errors (caused by needsupdate still being 1, not sure why though. The gradebook seems like witchcraft to me- manipulating the db records doesn't always seem to do what I'd expect). I've uploaded a newer version that deals with this and I've inserted the self_test function

Thanks,
Mike

Show
Mike Worth added a comment - Thanks for that, I'd seen the errors but couldn't work out why (and just ignored them as it seemed to work fine). I didn't know anything about local until I read that link, could it be better linked to other places in the docs or am I just a bit blind? I suppose it could go in local, although this strikes me as the sort of thing that might be used more widely (potentially with options to sort on things other than month). Would being in local put some people off (especially if it needed merging with another cron.php)? Also I've been having some problems with grade totals not refreshing properly and showing errors (caused by needsupdate still being 1, not sure why though. The gradebook seems like witchcraft to me- manipulating the db records doesn't always seem to do what I'd expect). I've uploaded a newer version that deals with this and I've inserted the self_test function Thanks, Mike
Hide
Anthony Borrow added a comment -

Mike - I came across a PHP notice while running cron which I suspect is related to this block.

Notice: Undefined property: stdClass::$sesskey in /home/arborrow/Moodle/code/19stable/grade/lib.php on line 1295

I've not looked into the code to see if or how to avoid it but wanted to bring it to your attention.

Peace - Anthony

Show
Anthony Borrow added a comment - Mike - I came across a PHP notice while running cron which I suspect is related to this block. Notice: Undefined property: stdClass::$sesskey in /home/arborrow/Moodle/code/19stable/grade/lib.php on line 1295 I've not looked into the code to see if or how to avoid it but wanted to bring it to your attention. Peace - Anthony
Hide
Anthony Borrow added a comment -

moving to Block: Catgrades component

Show
Anthony Borrow added a comment - moving to Block: Catgrades component
Hide
Anthony Borrow added a comment -

Mike - I have added the catgrades block to CVS, created the component in the tracker, and given you write access to it. I think it is important to have a good description of things in the Modules and Plugins database and also a good documentation page for this block especially because it is "non-traditional" in that the user will never see anything really about this block or interact with it. Thanks for sharing this code with the Moodle community. Peace - Anthony

Show
Anthony Borrow added a comment - Mike - I have added the catgrades block to CVS, created the component in the tracker, and given you write access to it. I think it is important to have a good description of things in the Modules and Plugins database and also a good documentation page for this block especially because it is "non-traditional" in that the user will never see anything really about this block or interact with it. Thanks for sharing this code with the Moodle community. Peace - Anthony
Hide
Mike Worth added a comment -

Have changed the M&P entry and created a page in docs; they obviously make perfect sense to me, what about everyone else?

Thanks,
Mike

Show
Mike Worth added a comment - Have changed the M&P entry and created a page in docs; they obviously make perfect sense to me, what about everyone else? Thanks, Mike
Hide
Anthony Borrow added a comment -

Mike for consistency purposes I had the documentation page moved to http://docs.moodle.org/en/Categorise_grades_block so that it would show up under C's instead of the lower case b for block/catgrades. I think the docs page should be a little more readable so Categorise grades block seemed better to me. Peace - Anthony

Show
Anthony Borrow added a comment - Mike for consistency purposes I had the documentation page moved to http://docs.moodle.org/en/Categorise_grades_block so that it would show up under C's instead of the lower case b for block/catgrades. I think the docs page should be a little more readable so Categorise grades block seemed better to me. 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 (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: