Files
edx-platform/lms/djangoapps/teams/services.py
Jansen Kantor b2f69fc803 EDUCATOR-4858: Update teams service to consider teamset/topic (#22834)
* update teams service and api to consider topic
2020-01-14 16:06:27 -05:00

22 lines
833 B
Python

""" Services to expose the Teams API to XBlocks """
from django.urls import reverse
class TeamsService(object):
""" 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_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,
)