Closed satwik-talluri closed 3 years ago
Hey @garg3133 , Please review this PR.
The UI part of the PR looks good. There are a few problems which I found in the working and implementation of this feature:
- On selecting a subject from dropdown and submitting it, the subject is being updated in the database field
subject_taught
, but does not get updated at the top alongside Subject Scheduled.- There is absolutely no need to update the subject taught at the top in realtime as we select different values in the dropdown.
- I don't understand why you passed the
selected_subject
as a context variable while accessing the dashboard. You could have just used{{ cw_hw.get_subject_taught_display }}
to display the subject. (Display "Not Updated" in case the subject_taught field is None.
@garg3133 I have passed the selected_subject as a context variable to fetch all subjects for the subject_taught dropdown. Please let me know if there is any other way
I have passed the selected_subject as a context variable to fetch all subjects for the subject_taught dropdown. Please let me know if there is any other way
Ohh! But still, it's a really expensive block of code as it goes through all the schedules and modifies the dictionary each time.
You can easily get all the subjects from Schedule.SUBJECTS tuple (import Schedule model from models.py, if not already imported).
I have passed the selected_subject as a context variable to fetch all subjects for the subject_taught dropdown. Please let me know if there is any other way
Ohh! But still, it's a really expensive block of code as it goes through all the schedules and modifies the dictionary each time.
You can easily get all the subjects from Schedule.SUBJECTS tuple (import Schedule model from models.py, if not already imported).
@garg3133 Thanks, all the problems have been resolved. Please check if it is okay now.
Looks good. Merging it into master.
Thanks, @satwik-talluri for working on this.
Related Issue
Fixes: #176
Prosposed Changes
Screenshots