Note:

If you want to create a new page for developers, you should create it on the Moodle Developer Resource site.

Groups: Difference between revisions

From MoodleDocs
No edit summary
Line 15: Line 15:
At present both groups and groupings may belong to several courses, you could use one group in several courses and groupings at the same time. This loose relationship of groups and groupings adds too much complexity and is a source of bugs in code.
At present both groups and groupings may belong to several courses, you could use one group in several courses and groupings at the same time. This loose relationship of groups and groupings adds too much complexity and is a source of bugs in code.


''Solution:'' Each group and grouping would link the course id directly. Groupings would be only ''limiting'' the number of usable groups. This allows free sharing of groups in groupings inside course without potential problems. This idea was proposed by Enrique. See attached db schema.
''Solution:'' Each group and grouping would link the course id directly. Groupings would be only limiting the number of usable groups in activities. This allows free sharing of groups in groupings inside course without potential problems. This idea was proposed by Enrique. See attached db schema.


[[Image:groupsdb.png]]
[[Image:groupsdb.png]]
Line 23: Line 23:
*normalized
*normalized
*simpler SQL
*simpler SQL
*faster
*easier backup/restore implementation
*easier backup/restore implementation
*more compatible with old group implementation in 1.7
*more compatible with old group implementation in 1.7

Revision as of 07:26, 18 July 2007

Improving the Groups design in Moodle 1.9

Summary of problems:

  • Can not define groupings at site level
  • Groupings not implemented in modules
  • Concept of orphaned groups
  • Not integrated into Moodle core
  • Unfinished and partially broken code

It would be very hard to improve current code without major refactoring and design changes. --Petr Škoda (škoďák) 02:37, 10 April 2007 (CDT)

Competing proposals

Change groups/groupings relationship

At present both groups and groupings may belong to several courses, you could use one group in several courses and groupings at the same time. This loose relationship of groups and groupings adds too much complexity and is a source of bugs in code.

Solution: Each group and grouping would link the course id directly. Groupings would be only limiting the number of usable groups in activities. This allows free sharing of groups in groupings inside course without potential problems. This idea was proposed by Enrique. See attached db schema.

groupsdb.png

Benefits:

  • fewer tables
  • normalized
  • simpler SQL
  • easier backup/restore implementation
  • more compatible with old group implementation in 1.7

Linked groups

TODO

Group/grouping cloning

TODO

Other code cleanup

Current group code does not follow Moodle coding guide, has several unfinished/broken/obsoleted parts, is not integrated into core, etc. To do:

  • integrate setup and upgrade into main lib/db/*.*
  • remove columns from groupings table that can be replaced by permissions
  • reduce the number of functions, rewrite or fix them, move them into lib/grouplib.php
  • rewrite UI in /group/
  • implement module and course groupings support, fix all mods to use it (course edit form, mod edit form, etc.)
  • fix legacy functions
  • documentation

Needed time

1 month for implementation and testing.