@extends('admin.layouts.master') @section('title','Quiz Report View') @section('maincontent') @include('admin.layouts.topbar',$data)
{{ __('Quiz Report View') }}
@foreach($quiz as $q) @php $course = App\Course::where('id',$q['course_id'])->first(); $user = App\User::where('email',$q['useremail'])->first(); $ans = App\QuizAnswer::where('topic_id',$q['topicid'])->where('user_id',$user->id)->get(); if(isset($course)){ if(Auth::user()->role == "instructor") { $check = $course->user_id == Auth::user()->id; } else{ $check = $ans; } } @endphp @if(isset($check)) @endif @endforeach
{{ __('User') }} {{ __('Email') }} {{ __('Quiz') }} {{ __('Marks Get') }} {{ __('Total Marks') }}
{{ $q['fname'] }} {{$q['lname']}} {{ $q['useremail'] }} {{ $q['topictitle'] }} @php $mark=0; $correct = collect(); foreach($ans as $answer){ if($answer->type != 1){ if($answer->user_answer == $answer->answer){ $mark++; } }else{ if($answer->txt_approved == 1){ $mark++; } } } $correct = $mark*$q['per_q_mark']; @endphp {{$correct}} {{ $q['quizquestion_count'] * $q['per_q_mark'] }}
@endsection