Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion searchapp/static/student_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,14 @@ function populate_subjects(value,text, $selectedItem) {
$(`#${worksheetType}-breakup-options-parent`).empty();
$(`#${worksheetType}-breakup`).removeClass('hide-display').addClass('show-display');
subject_breakup.forEach(function(breakup){
let paperElement = `<div class="item" data-value=${breakup}>${breakup}</div>`;
let paperElement = `<div class="item" data-value=${breakup['name']}>
<span class="text">${breakup['name']}</span>
<span class="description">
Marks: ${breakup['question_weightage']} &emsp;
Type: ${breakup['question_type']} &emsp;
Attempt ${breakup['questions_to_attempt']} out of ${breakup['total_questions']}
</span>
</div>`;
$(`#${worksheetType}-breakup-options-parent`).append(paperElement);
})
}
Expand Down
2 changes: 1 addition & 1 deletion searchapp/templates/student_view.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
</div>
</div>
<br>
<div id="test-breakup" class="ui selection dropdown breakup hide-display">
<div id="test-breakup" class="ui selection labeled dropdown breakup hide-display">
<input name="breakup" type="hidden">
<i class="dropdown icon"></i>
<div class="default text">Select paper format</div>
Expand Down
8 changes: 4 additions & 4 deletions searchapp/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,13 +243,13 @@ def get_chapters(request):
board = request.GET['board']
chapters = Chapter.objects.filter(
subject__id=subject).values_list('id', 'chapter_name')
subject_breakup = list(SubjectSplit.objects.filter(
subject_breakup = SubjectSplit.objects.filter(
board__board=board).values_list(
'name'
).distinct())
'name', 'question_weightage', 'question_type', 'total_questions', 'questions_to_attempt'
)
json_data = {
'chapters': [{'chapter_id': x[0], 'chapter_name': x[1]} for x in chapters],
'subject_breakup': subject_breakup,
'subject_breakup': [{'name': x[0], 'question_weightage': x[1], 'question_type': x[2], 'total_questions': x[3], 'questions_to_attempt': x[4]} for x in subject_breakup],
}
return JsonResponse(json_data)

Expand Down