CAT-SOOP API: catsoop.groups

Utilities for handling grouping of students

View Source

Members

  • catsoop.groups.add_to_group (function, lines 90-120)

    Adds the given user to the given group.

    Parameters:

    • context: the context associated with this request
    • path: a list of strings representing the path we're interested in
    • username: the user whose group we want to find
    • group: the name of the group to which the student should be added

    Returns: None on success, or an error message on failure.

 

  • catsoop.groups.get_group (function, lines 58-87)

    Get a user's group for a page

    Parameters:

    • context: the context associated with this request
    • path: a list of strings representing the path we're interested in
    • username: the user whose group we want to find

    Optional Parameters:

    • groups (default None): a listing of groups (of the same form as the output from catsoop.groups.list_groups). If none is specified, catsoop.groups.list_groups is invoked.
    • secnum (default None): the section in which to look for groups. If none is specified, catsoop.groups.get_section is invoked).

    Returns: the section number and group to which the given user belongs, or None if they have not been assigned a group.

 

  • catsoop.groups.get_section (function, lines 38-55)

    Helper function to determine a user's section, if any.

    Parameters:

    • context: the context associated with this request
    • course: the course
    • username: the user whose section we want to find

    Returns: a string; the user's section, or 'default' if the user has no section

 

  • catsoop.groups.list_groups (function, lines 25-35)

    Parameters:

    • context: the context associated with this request
    • path: a list of strings representing the path we're interested in

    Returns: a dictionary mapping group names to lists of group members

 

  • catsoop.groups.make_all_groups (function, lines 182-250)

    Randomly assigns groups within the given section for the given page, overwriting any existing groups for that section and page.

    All users with a file in __USERS__ who are members of the given section are considered.

    Several variables in the given context affect the way groups are assigned:

    • The students can optionally be separated into subcategories (such that each student will only be partnered with other within their subcategory) by specifying a function cs_group_category(path, username) => category_name.

    • The names to be given to the various groups can be specified in cs_group_names, which should be a list of strings.

    • Within each subcategory, students are randomly shuffled, and groups of size cs_group_size are made from the shuffled list. Students will never be paired with students outside their subcategory, even is cs_group_size does not evenly divide the number of students in a category.

    Parameters:

    • context: the context associated with this request
    • path: a list of strings representing the path we're interested in
    • section: the section whose groups should be replaced

    Returns: None on success, or an error message on failure.

 

  • catsoop.groups.overwrite_groups (function, lines 156-179)

    Overwrites group assignments for the given section

    Parameters:

    • context: the context associated with this request
    • path: a list of strings representing the path we're interested in
    • section: the section whose groups should be replaced
    • newdict: the new group assignments, as a dictionary mapping group names to lists of group members' usernames

    Returns: None on success, or an error message on failure.

 

  • catsoop.groups.remove_from_group (function, lines 123-153)

    Removes the given user from the given group.

    Parameters:

    • context: the context associated with this request
    • path: a list of strings representing the path we're interested in
    • username: the user whose group we want to find
    • group: the name of the group from which the student should be removed

    Returns: None on success, or an error message on failure.