|
5 | 5 | pattern. |
6 | 6 | """ |
7 | 7 | from datetime import datetime |
| 8 | +from typing import List |
8 | 9 |
|
9 | 10 | import attr |
10 | | -from opaque_keys.edx.keys import CourseKey |
| 11 | +from opaque_keys.edx.keys import CourseKey, UsageKey |
11 | 12 |
|
12 | 13 |
|
13 | 14 | @attr.s(frozen=True) |
@@ -135,3 +136,49 @@ class CohortData: |
135 | 136 | user = attr.ib(type=UserData) |
136 | 137 | course = attr.ib(type=CourseData) |
137 | 138 | name = attr.ib(type=str) |
| 139 | + |
| 140 | + |
| 141 | +@attr.s(frozen=True) |
| 142 | +class DiscussionTopicContext: |
| 143 | + """ |
| 144 | + Attributes defined for Open edX Discussion Topic Context object. |
| 145 | +
|
| 146 | + Context for linking the external id for a discussion topic to its associated usage key. |
| 147 | +
|
| 148 | + Arguments: |
| 149 | + title (str): is cached to improve the performance. |
| 150 | + usage_key (str): usage key. |
| 151 | + group_id(int): can be used for providers that don't internally support cohorting. |
| 152 | + external_id(str): store the commentable id. |
| 153 | + """ |
| 154 | + |
| 155 | + title = attr.ib(type=str) |
| 156 | + usage_key = attr.ib(type=UsageKey, default=None) |
| 157 | + group_id = attr.ib(type=int, default=None) |
| 158 | + external_id = attr.ib(type=str, default=None) |
| 159 | + |
| 160 | + |
| 161 | +@attr.s(frozen=True) |
| 162 | +class CourseDiscussionConfigurationData: |
| 163 | + """ |
| 164 | + Attributes defined for Open edX Course Discussion Configuration Data object. |
| 165 | +
|
| 166 | + Contains all the metadata needed to configure discussions for a course. |
| 167 | +
|
| 168 | + Arguments: |
| 169 | + course_key(str): information about the course |
| 170 | + provider_type(str): provider type |
| 171 | + enable_in_context(bool): enable in context |
| 172 | + enable_graded_units(bool): enable grade units |
| 173 | + plugin_configuration(dict): plugin configuration |
| 174 | + contexts(List): field contains all the contexts for which discussion |
| 175 | + is to be enabled. |
| 176 | + """ |
| 177 | + |
| 178 | + course_key = attr.ib(type=CourseKey) |
| 179 | + provider_type = attr.ib(type=str) |
| 180 | + enable_in_context = attr.ib(type=bool, default=True) |
| 181 | + enable_graded_units = attr.ib(type=bool, default=False) |
| 182 | + unit_level_visibility = attr.ib(type=bool, default=False) |
| 183 | + plugin_configuration = attr.ib(type=dict, default={}) |
| 184 | + contexts = attr.ib(type=List[DiscussionTopicContext], factory=list) |
0 commit comments