Skip to content
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

Add feature to edit questions #61

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

KIRA009
Copy link
Collaborator

@KIRA009 KIRA009 commented Nov 9, 2019

Admin can now edit questions from the database. Filters can be applied
while searching for the questions

Object.keys(filters).forEach(filter => {
if (removed) return;
// console.log(filter)
// console.log(question[filter])
Copy link
Collaborator

@ishanisri ishanisri Dec 10, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove all console.log()

def edit_questions(request):
if request.method == 'GET':
board_list = Board.objects.all().values_list('board', flat=True)
chapters = Chapter.objects.all().values_list('chapter_name', flat=True).distinct()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you look at the way boards and grades are being queried for generating test papers, then subject, chapters and grade are referred using foreign key and not by using distinct(). Using distinct() will not allow changes to be mapped properly hence do not use it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In generation of test papers, the subjects and grades are queried based on the board name. Here, everything is queried as a whole, so I used distinct to not have repeating results, for example, a Science subject for both class 9 and 10, or a Science subject for ICSE and CBSE should be treated as one subject only, because we can use filters for class and board respectively, to get the desired category of questions

Also did not understand this

Using distinct() will not allow changes to be mapped properly hence do not use it.

Admin can now edit questions from the database. Filters can be applied
while searching for the questions
Also, removed bug regarding duplicating of some fields. And added
notification when question is successfully edited in the database
@KIRA009 KIRA009 force-pushed the feat/edit-questions branch from fd66c49 to ae2c67c Compare February 6, 2020 14:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants