@extends('../layout/' . $layout) @section('subhead') Atarud MIS - Manage Exam Marks @endsection @section('subcontent')

Manage Exam Marks

{{-- Add --}}
@csrf
@php $total_marks = App\Models\Exam::where('id', $exam->id)->first()->total_marks; $count = 0; @endphp @php // $students = App\Models\StudentCourses::where('course_id', $exam->course_id) // ->get(); // $students = App\Models\StudentExamGroup::where('course_id', $exam->course_id) // ->where('exam_id',$exam->id) // ->where('status', 'Completed') // ->get(); // return $request; @endphp @foreach($students as $row) @php $student = App\Models\Student::where('id', $row->student_id) // ->where('status', 'active') ->first(); $att = App\Models\Attendance::where('student_id', $row->student_id) ->where('course_id', $course->id) ->where('status', 1) ->count(); if($student == null) continue; $row2 = App\Models\Mark::where('exam_id', $exam->id)-> where('student_id', $row->student_id)-> first(); $writing = App\Models\ExamQuestionSetting::where('exam_type_id', 1)->where('exam_setting_id', $exam->exam_setting_id)->first(); $listening = App\Models\ExamQuestionSetting::where('exam_type_id', 2)->where('exam_setting_id', $exam->exam_setting_id)->first(); $speaking = App\Models\ExamQuestionSetting::where('exam_type_id', 3)->where('exam_setting_id', $exam->exam_setting_id)->first(); $reading = App\Models\ExamQuestionSetting::where('exam_type_id', 4)->where('exam_setting_id', $exam->exam_setting_id)->first(); $writing = $writing != null ? $writing->total : 1; $listening = $listening != null ? $listening->total : 1; $speaking = $speaking != null ? $speaking->total : 1; $reading = $reading != null ? $reading->total : 1; $wr = $rd = $li = $sp = $hm = $total = $totalWr = $trd = $tli = $tsp = $thm = 0; $twr = $trd = $tli = $tsp = $thm = 0; if($row2 != null){ $wr = $row2->wr; $rd = $row2->rd; $li = $row2->li; $sp = $row2->sp; $hm = $row2->hm; $total = $row2->mark_obtained; }else{ $totalWr = 0; $qs = App\Models\StudentExamScore::where('student_id',$row->student_id)->where('exam_id', $exam->id)->get(); // dd($qs); foreach($qs as $q){ $qb = App\Models\QuestionBank::where('id', $q->question_id)->first(); if($qb->exam_type_id == 1 ){ if($q->answerStatus == "Correct"){ ++$wr;} ++$twr;} if($qb->exam_type_id == 2 ){ if($q->answerStatus == "Correct"){ ++$li;} ++$tli;} if($qb->exam_type_id == 3 ){ if($q->answerStatus == "Correct"){ ++$sp;} ++$tsp;} if($qb->exam_type_id == 4 ){ if($q->answerStatus == "Correct"){ ++$rd;} ++$trd;} } $wr = ($writing * $wr)/ ($twr == 0 ? 1 : $twr); $li = ($listening * $li)/ ($tli == 0 ? 1 : $tli); $sp = ($speaking * $sp)/ ($tsp == 0 ? 1 : $tsp); $rd = ($reading * $rd)/ ($trd == 0 ? 1 : $trd); $total = $wr + $li + $sp + $rd; $row2 = App\Models\Mark::create([ 'student_id' => $row->student_id, 'program_id' => $exam->program_id, 'semester_id' => $exam->semester_id, 'section_id' => $exam->section_id, 'course_id' => $exam->course_id, 'exam_id' => $exam->id, 'mark_obtained' => $total, 'wr' => $wr, 'hm' => $hm, 'rd' => $rd, 'li' => $li, 'sp' => $sp, ]); $wr = $row2->wr; $rd = $row2->rd; $li = $row2->li; $sp = $row2->sp; $hm = $row2->hm; $total = $row2->mark_obtained; } @endphp {{-- @foreach($marks as $row2) --}} @endforeach
# Student ID Student Name Student Father Name Writing Speaking listinig Reading Home Work FL Mark Obtained (out of $total_marks)
{{++$count}} {{$student->id}} {{$student->name}} {{$student->father_name}}
@endsection @section('script') @endsection