Example #1
0
 def _get_rest(course: models.Course) -> t.Mapping[str, t.Any]:
     if request.args.get('extended') == 'true':
         return {
             'assignments': course.get_all_visible_assignments(),
             **course.__to_json__(),
         }
     return course.__to_json__()
Example #2
0
    def _get_rest(course: models.Course) -> t.Mapping[str, t.Any]:
        if helpers.extended_requested():
            snippets: t.Sequence[models.CourseSnippet] = []
            if (current_user.has_permission(GPerm.can_use_snippets)
                    and current_user.has_permission(
                        CPerm.can_view_course_snippets, course_id=course.id)):
                snippets = course.snippets

            return {
                'assignments': course.get_all_visible_assignments(),
                'group_sets': course.group_sets,
                'snippets': snippets,
                **course.__to_json__(),
            }
        return course.__to_json__()