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
This commit is contained in:
Serhiii Nanai
2025-12-02 20:52:36 +02:00
committed by GitHub
parent 82f574ec2c
commit 0c3d709d63

View File

@@ -96,8 +96,27 @@ class GradingPolicySerializer(ReadOnlySerializer):
"""
Serializer for grading policy
"""
# This implementation of the color coding feature is temporary and for testing purposes only.
# All CSS should be handled by design tokens, this is not implemented yet in Paragon.
# The backend should only work with labels, and the final design includes dynamic Label assignment per course
# (not CSS codes but color Labels), platform-level configuration, etc.
# See discussions in the associated PR for further details: https://github.com/openedx/edx-platform/pull/37438
ASSIGNMENT_COLORS = [
"#D24242", # Crimson Red
"#7B9645", # Olive Green
"#5A5AD8", # Periwinkle Blue
"#B0842C", # Amber Gold
"#2E90C2", # Ocean Blue
"#D13F88", # Magenta Pink
"#36A17D", # Jade Green
"#AE5AD8", # Lavender Purple
"#3BA03B", # Forest Green
]
assignment_policies = serializers.SerializerMethodField()
grade_range = serializers.DictField(source='GRADE_CUTOFFS')
assignment_colors = serializers.SerializerMethodField()
def get_assignment_policies(self, grading_policy):
return [{
@@ -108,6 +127,9 @@ class GradingPolicySerializer(ReadOnlySerializer):
'weight': assignment_policy['weight'],
} for assignment_policy in grading_policy['GRADER']]
def get_assignment_colors(self, obj):
return self.ASSIGNMENT_COLORS
class CertificateDataSerializer(ReadOnlySerializer):
"""