Issue Details (XML | Word | Printable)

Key: MDL-9506
Type: Sub-task Sub-task
Status: Resolved Resolved
Resolution: Fixed
Priority: Blocker Blocker
Assignee: Nicolas Connault
Reporter: Martin Dougiamas
Votes: 1
Watchers: 3
Operations

Add/Edit UI Mockup to this issue
If you were logged in you would be able to see more operations.
Moodle
MDL-9137

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

Created: 23/Apr/07 01:55 PM   Updated: 04/Dec/07 02:41 PM
Component/s: Gradebook
Affects Version/s: 1.8
Fix Version/s: 1.9

Participants: Chardelle Busch, Martin Dougiamas and Nicolas Connault
Security Level: None
Resolved date: 04/Dec/07
Affected Branches: MOODLE_18_STABLE
Fixed Branches: MOODLE_19_STABLE


 Description  « Hide
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.



 All   Comments   Change History   Version Control      Sort Order: Ascending order - Click to sort in descending order
Nicolas Connault added a comment - 02/May/07 03:51 PM
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


Nicolas Connault added a comment - 21/May/07 11:12 AM
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


Nicolas Connault added a comment - 21/May/07 01:55 PM
Just completed 6. Category keephigh and droplow

Martin Dougiamas added a comment - 28/Jun/07 02:36 PM
These are more or less finished right?

Nicolas Connault added a comment - 29/Jun/07 02:43 AM
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

Martin Dougiamas added a comment - 06/Nov/07 01:39 PM
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).


Martin Dougiamas added a comment - 21/Nov/07 02:21 PM
Nicolas, can you go ahead on these ASAP?

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


Nicolas Connault added a comment - 21/Nov/07 06:05 PM
Implemented and tested the new API functions. All OK.

Chardelle Busch added a comment - 26/Nov/07 10:45 AM
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.


Nicolas Connault added a comment - 27/Nov/07 06:16 PM
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.


Martin Dougiamas added a comment - 04/Dec/07 02:40 PM
Looks OK to me! We can always extend it later I guess if we need to.

Nicolas Connault added a comment - 04/Dec/07 02:41 PM
Final approval received, closing the issues.