Files
edx-platform/lms/djangoapps/teams/services.py
Nathan Sprenkle 1212e3550c feat: ora staff grader backend (#29828)
- Adds Enhanced Staff Grader (ESG) backend-for-frontend (BFF) in `lms/djangoapps/ora_staff_grader`
    - Adds routing to ESG BFF at `{lms_url}/api/ora_staff_grader/*`
    - Adds mock implementation routing at `{lms_url}/api/ora_staff_grader/mock/*`
    - Adds `ORA_GRADING_MICROFRONTEND_URL` setting for routing to ESG microfrontend (MFE)
- Updates to the teams app:
    - Add`get_teams_in_teamset` to the teams API.
    - Add `get_team_names` to teams service.
- Adds `openassessment.staffgrader` app for appropriate ORA migrations.
- Modifies management commands for creation of users.
- Updates test factory to return display org with course overview.

Co-authored-by: jansenk <jkantor@edx.org>
Co-authored-by: Leangseu Kim <lkim@edx.org>
Co-authored-by: Ben Warzeski <bwarzeski@edx.org>
2022-01-31 11:09:41 -05:00

40 lines
1.4 KiB
Python

""" Services to expose the Teams API to XBlocks """
from django.urls import reverse
class TeamsService:
""" Functions to provide teams functionality to XBlocks"""
def get_team(self, user, course_id, topic_id):
from . import api
return api.get_team_for_user_course_topic(user, course_id, topic_id)
def get_team_names(self, course_id, topic_id):
"""
Given a course and topic id, return a dict mapping from team id to team name for teams in that topic
"""
from . import api
teams = api.get_teams_in_teamset(course_id, topic_id)
name_mapping = {team.team_id: team.name for team in teams}
return name_mapping
def get_team_by_team_id(self, team_id):
from . import api
return api.get_team_by_team_id(team_id)
def get_team_detail_url(self, team):
""" Returns the url to the detail view for the given team """
teams_dashboard_url = reverse('teams_dashboard', kwargs={'course_id': team.course_id})
# Unfortunately required since this URL resolution is done in a Backbone view
return "{teams_dashboard_url}#teams/{topic_id}/{team_id}".format(
teams_dashboard_url=teams_dashboard_url,
topic_id=team.topic_id,
team_id=team.team_id,
)
def get_anonymous_user_ids_for_team(self, user, team):
from . import api
return api.anonymous_user_ids_for_team(user, team)