Moodle

Write core API functions lib/gradelib.php and unit tests

Details

  • Type: Sub-task Sub-task
  • Status: Closed Closed
  • Priority: Blocker Blocker
  • Resolution: Fixed
  • Affects Version/s: 1.8
  • Fix Version/s: 1.9
  • Component/s: Gradebook
  • Labels:
    None
  • Affected Branches:
    MOODLE_18_STABLE
  • Fixed Branches:
    MOODLE_19_STABLE

Description

http://docs.moodle.org/en/Development:Grades#Core_API_functions

grade_get_items()
eg grade_get_items($courseid, $itemname=NULL, $itemtype=NULL, $itemmodule=NULL, $iteminstance=NULL, $itemnumber=NULL, $idnumber=NULL)
For extracting all the information about what grading items are attached to something. For example, an assignment may want to retrieve all the grade_items for itself, and get three outcome scales in return. This will affect the grading interface.

grade_create_item()
To create a new grade_item in case it doesn't exist. This function would be called when a module is created or updated, for example, to ensure grade_item entries exist. It's not essential though - if grades are being added later and a matching grade_item doesn't exist yet, the gradebook will create them on the fly.

grade_create_category()
eg grade_create_category(fullname, array of items, aggregation, etc ...) For a given set of items, create a category to group them together (if one doesn't exist yet). Modules may want to do this when they are created. However, the ultimate control is in the gradebook interface itself.

grade_is_locked($itemtype, $itemmodule, $itemteminstance, $userid=NULL)
This function will tell a module whether a grade (or grade_item if $userid is not given) is currently locked or not. This is a combination of the actual settings in the grade tables and a check on moodle/course:editgradeswhenlocked. If it's locked to the current use then the module can print a nice message or prevent editing in the module.

Activity

Hide
Nicolas Connault added a comment -

Things left to do:

1. Outcomes:
a. Implement grade_outcome object
b. Implement support methods in grade_item
c. write unit tests

2. Grade history
a. Implement API to view history
b. Methods to extract data from history
c. Methods to export/import

3. Multiple grades
a. Relate grade_items that are part of a multiple grade set together
b. Automatically aggregate multiple grade_items under a category

4. Text grade type
a. Handle calculations, aggregation and adjustments of grades set to text type

5. Hierarchical Locking and Hiding

6. Category keephigh and droplow

7. Grade text: methods for adding and editing grade_text easily

8. Grade pass: method for querying whether a particular student passes a given grade_item

9. Use grade_item.sortorder in queries

10. Grade_category::get_children: easy way to access a category's children to a requested depth (or all children) in hierarchical or flat array format.

11. Grade category aggregation

12. Calculation formula parser

Show
Nicolas Connault added a comment - Things left to do: 1. Outcomes: a. Implement grade_outcome object b. Implement support methods in grade_item c. write unit tests 2. Grade history a. Implement API to view history b. Methods to extract data from history c. Methods to export/import 3. Multiple grades a. Relate grade_items that are part of a multiple grade set together b. Automatically aggregate multiple grade_items under a category 4. Text grade type a. Handle calculations, aggregation and adjustments of grades set to text type 5. Hierarchical Locking and Hiding 6. Category keephigh and droplow 7. Grade text: methods for adding and editing grade_text easily 8. Grade pass: method for querying whether a particular student passes a given grade_item 9. Use grade_item.sortorder in queries 10. Grade_category::get_children: easy way to access a category's children to a requested depth (or all children) in hierarchical or flat array format. 11. Grade category aggregation 12. Calculation formula parser
Hide
Nicolas Connault added a comment -

Things left to do:

2. Grade history
b. Methods to extract data from history
c. Methods to export/import

3. Multiple grades
a. Relate grade_items that are part of a multiple grade set together
b. Automatically aggregate multiple grade_items under a category

4. Text grade type
a. Handle calculations, aggregation and adjustments of grades set to text type

6. Category keephigh and droplow

8. Grade pass: method for querying whether a particular student passes a given grade_item

12. Calculation formula parser

Show
Nicolas Connault added a comment - Things left to do: 2. Grade history b. Methods to extract data from history c. Methods to export/import 3. Multiple grades a. Relate grade_items that are part of a multiple grade set together b. Automatically aggregate multiple grade_items under a category 4. Text grade type a. Handle calculations, aggregation and adjustments of grades set to text type 6. Category keephigh and droplow 8. Grade pass: method for querying whether a particular student passes a given grade_item 12. Calculation formula parser
Hide
Nicolas Connault added a comment -

Just completed 6. Category keephigh and droplow

Show
Nicolas Connault added a comment - Just completed 6. Category keephigh and droplow
Hide
Martin Dougiamas added a comment -

These are more or less finished right?

Show
Martin Dougiamas added a comment - These are more or less finished right?
Hide
Nicolas Connault added a comment -

A number of sub-tasks can be derived from this one, which don't really fall directly under it. So I guess this task is finished, but the following need to be addressed:

  • Outcomes : Unit tests and GUI implementation
  • Grade history GUI and tools (backup/restore)
  • Grade pass
Show
Nicolas Connault added a comment - A number of sub-tasks can be derived from this one, which don't really fall directly under it. So I guess this task is finished, but the following need to be addressed:
  • Outcomes : Unit tests and GUI implementation
  • Grade history GUI and tools (backup/restore)
  • Grade pass
Hide
Martin Dougiamas added a comment -

Some new functions have been added here: http://docs.moodle.org/en/Development:Grades#Core_API_functions

and are being discussed here:

http://moodle.org/mod/forum/discuss.php?d=80115#p370647

Please implement these once there is some consensus (give it a couple of days).

Show
Martin Dougiamas added a comment - Some new functions have been added here: http://docs.moodle.org/en/Development:Grades#Core_API_functions and are being discussed here: http://moodle.org/mod/forum/discuss.php?d=80115#p370647 Please implement these once there is some consensus (give it a couple of days).
Hide
Martin Dougiamas added a comment -

Nicolas, can you go ahead on these ASAP?

http://docs.moodle.org/en/Development:Grades#Core_API_functions

Show
Martin Dougiamas added a comment - Nicolas, can you go ahead on these ASAP? http://docs.moodle.org/en/Development:Grades#Core_API_functions
Hide
Nicolas Connault added a comment -

Implemented and tested the new API functions. All OK.

Show
Nicolas Connault added a comment - Implemented and tested the new API functions. All OK.
Hide
Chardelle Busch added a comment -

I'm have a tough time getting these functions to do what I need. I've posted the code I need to update to the new API functions in the above mentioned discussion. I sent Nicolas an email too, but didn't get an answer. Any hints on how I can get these to replace the old _grades function would be great.

Thanks.

Show
Chardelle Busch added a comment - I'm have a tough time getting these functions to do what I need. I've posted the code I need to update to the new API functions in the above mentioned discussion. I sent Nicolas an email too, but didn't get an answer. Any hints on how I can get these to replace the old _grades function would be great. Thanks.
Hide
Nicolas Connault added a comment -

Answer to Chardelle documented at http://docs.moodle.org/en/Development:Grades#Example_of_using_the_API

Please review it and close this issue once the API functions are approved.

Show
Nicolas Connault added a comment - Answer to Chardelle documented at http://docs.moodle.org/en/Development:Grades#Example_of_using_the_API Please review it and close this issue once the API functions are approved.
Hide
Martin Dougiamas added a comment -

Looks OK to me! We can always extend it later I guess if we need to.

Show
Martin Dougiamas added a comment - Looks OK to me! We can always extend it later I guess if we need to.
Hide
Nicolas Connault added a comment -

Final approval received, closing the issues.

Show
Nicolas Connault added a comment - Final approval received, closing the issues.

People

Vote (1)
Watch (3)

Dates

  • Created:
    Updated:
    Resolved: