-
Notifications
You must be signed in to change notification settings - Fork 34
feat: Grade marks #320
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Grade marks #320
Conversation
orronai
commented
Sep 30, 2021
•
edited
Loading
edited
- Added grade marks to solution`s
- Added a menu to choose the grade mark for the admin in the solution view page
- Added a test
- Fixed some tests
- Added to the user`s table the grade mark
- Added migration
- Added grades table - Added backend and frontend implementaion
- Added the grade to the user`s table
Codecov Report
@@ Coverage Diff @@
## master #320 +/- ##
==========================================
+ Coverage 84.02% 84.08% +0.06%
==========================================
Files 62 63 +1
Lines 2823 2903 +80
==========================================
+ Hits 2372 2441 +69
- Misses 451 462 +11
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An awesome start!
- added active color column - changed the way the user chooses colors
lms/lmsdb/models.py
Outdated
is_color_changed = not instance.color.startswith('#') | ||
if created or is_color_changed: | ||
instance.color = COLORS.get(instance.color, '#0d6efd') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
Another way that might prove useful:
hex_color = re.compile(r'#?(?P<hex>[a-f0-9]{3}|[a-f0-9{6}])')
def get_hex(number: str) -> Optional[str]:
if color := hex_color.match(number):
return color.groupdict()['hex']
raise ValueError("This is not a valid hex color.")
...
def evalutaion_on_save_handler etc
try:
instance.color = get_hex_color(...)
except ValueError:
instance.color = DEFAULT_PRIMARY_COLOR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, to be really awesome, you might want to support input like "red", "blue" etc.
There's probably a really easy way to convert these words into hex RGB representation, and this can be awesome.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed it like the way you did and added the COLORS
dict in case the user entered a word like "red", "blue" and etc.
lms/lmsdb/models.py
Outdated
class SolutionAssessment(BaseModel): | ||
name = CharField() | ||
icon = CharField(null=True) | ||
color = CharField() | ||
active_color = CharField() | ||
order = IntegerField(default=0, index=True, unique=True) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- I think we should support different assessments per course. WDYT?
- Also: How we deal with a manager removing an assessment? (both 1. completely from the course and 2. de-selecting an evaluation from a specific solution)
- Changed the exercise number pre_save - Removed unique from assessments oreder - Assessments are now per course
This pull request introduces 1 alert when merging 5134179 into f18eeca - view on LGTM.com new alerts:
|
- Splitted a function - Changed some logics of the assessment
Sourcery Code Quality Report✅ Merging this PR will increase code quality in the affected files by 0.06%.
Here are some functions in these files that still need a tune-up:
Legend and ExplanationThe emojis denote the absolute quality of the code:
The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request. Please see our documentation here for details on how these metrics are calculated. We are actively working on this report - lots more documentation and extra metrics to come! Help us improve this quality report! |