Skip to content

Commit 0c3d709

Browse files
authored
feat: add assignment color codes to Progress API (#37438)
* feat: change list of color codes * fix: add missing color * style: rename attribute for assignment color list * docs: add explanation for current implementation
1 parent 82f574e commit 0c3d709

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

lms/djangoapps/course_home_api/progress/serializers.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,27 @@ class GradingPolicySerializer(ReadOnlySerializer):
9696
"""
9797
Serializer for grading policy
9898
"""
99+
100+
# This implementation of the color coding feature is temporary and for testing purposes only.
101+
# All CSS should be handled by design tokens, this is not implemented yet in Paragon.
102+
# The backend should only work with labels, and the final design includes dynamic Label assignment per course
103+
# (not CSS codes but color Labels), platform-level configuration, etc.
104+
# See discussions in the associated PR for further details: https://github.com/openedx/edx-platform/pull/37438
105+
ASSIGNMENT_COLORS = [
106+
"#D24242", # Crimson Red
107+
"#7B9645", # Olive Green
108+
"#5A5AD8", # Periwinkle Blue
109+
"#B0842C", # Amber Gold
110+
"#2E90C2", # Ocean Blue
111+
"#D13F88", # Magenta Pink
112+
"#36A17D", # Jade Green
113+
"#AE5AD8", # Lavender Purple
114+
"#3BA03B", # Forest Green
115+
]
116+
99117
assignment_policies = serializers.SerializerMethodField()
100118
grade_range = serializers.DictField(source='GRADE_CUTOFFS')
119+
assignment_colors = serializers.SerializerMethodField()
101120

102121
def get_assignment_policies(self, grading_policy):
103122
return [{
@@ -108,6 +127,9 @@ def get_assignment_policies(self, grading_policy):
108127
'weight': assignment_policy['weight'],
109128
} for assignment_policy in grading_policy['GRADER']]
110129

130+
def get_assignment_colors(self, obj):
131+
return self.ASSIGNMENT_COLORS
132+
111133

112134
class CertificateDataSerializer(ReadOnlySerializer):
113135
"""

0 commit comments

Comments
 (0)