@extends('layouts.frontend_leaderboard') @section('title', $quiz->title) @section('styles') {!! SEO::generate() !!} @endsection @section('content') @auth @if (auth()->user()->profile_picture != null) @php $user_profile = auth() ->user() ->profile_picture->getUrl(); @endphp @else @php $user_profile = '/theme/v2/images/new_logo1.png'; @endphp @endif @endauth
{{ $quiz->title }}
@php $today = request()->get('date') ?? null; $first_date = null; @endphp @if ($today) @php $active_class = 'active-tab'; $today_count = 0; @endphp @else @php $active_class = 'inactive-tab'; $today_count = 0; @endphp @endif @forelse ($filter_dates as $date) @if ($today_count == 0) @php $first_date = $date->start_date; @endphp @endif
@php $date_to_filter = Carbon\Carbon::parse($date->start_date)->format('Y-m-d'); @endphp
{{ Carbon\Carbon::parse($date->start_date)->format('d M Y') }}
@php $today_count++; @endphp @empty @endforelse
@forelse ($today_scorecard as $question) Question: {!! $question->questionAnswer->question !!} @php $correct_answer_column = $question->questionAnswer->correct_answer; $correct_answer = \App\Models\questionAnswer::select($correct_answer_column) ->where('quiz_id', $quiz->id) ->where('id', $question->question_id) ->first(); @endphp

Answer: {!! $correct_answer[$correct_answer_column] !!}

@empty @endforelse
@if (isset($today_scorecard[0]->rank_1))
Winner(s) of {{ \Carbon\Carbon::parse($today ?? $first_date)->format('d M Y') }}
@php $blank = ''; @endphp
@if (isset($today_scorecard[0]->rank_1)) @php $user = \App\Models\User::find($today_scorecard[0]->rank_1); @endphp @if ($user->profile_picture != null) @php $user_score_profile = $user->profile_picture->getUrl(); @endphp @else @php $user_score_profile = '/theme/v2/images/new_logo1.png'; @endphp @endif @php $question_id = $today_scorecard[0]->question_id; $quiz_id = $quiz->id; $user_id = $user->id; $submitted_on = \App\Models\ParticipantAnswer::select('submitted_on') ->where(['user_id' => $user_id, 'quiz_id' => $quiz_id, 'question_id' => $question_id]) ->first(); @endphp

1st Place

{{ $user->name }}

{{ $user->email ?? $blank }}

{{ $user->city ?? $blank }}

Submitted at: {{ \Carbon\Carbon::parse($submitted_on->submitted_on)->format('h:i:sa') }}

@endif @if (isset($today_scorecard[0]->rank_2)) @php $user = \App\Models\User::find($today_scorecard[0]->rank_2); @endphp @if (isset($user->profile_picture)) @php $user_score_profile = $user->profile_picture->getUrl(); @endphp @else @php $user_score_profile = '/theme/v2/images/new_logo1.png'; @endphp @endif @php $question_id = $today_scorecard[0]->question_id; $quiz_id = $quiz->id; $user_id = $user->id; $submitted_on = \App\Models\ParticipantAnswer::select('submitted_on') ->where(['user_id' => $user_id, 'quiz_id' => $quiz_id, 'question_id' => $question_id]) ->first(); @endphp

2nd Place

{{ $user->name }}

{{ $user->email }}

{{ $user->city }}

Submitted at: {{ \Carbon\Carbon::parse($submitted_on->submitted_on)->format('h:i:sa') }}

@endif @if (isset($today_scorecard[0]->lucky_winner_1)) @php $user = \App\Models\User::find($today_scorecard[0]->lucky_winner_1); @endphp @if ($user->profile_picture != null) @php $user_score_profile = $user->profile_picture->getUrl(); @endphp @else @php $user_score_profile = '/theme/v2/images/new_logo1.png'; @endphp @endif @php $question_id = $today_scorecard[0]->question_id; $quiz_id = $quiz->id; $user_id = $user->id; $submitted_on = \App\Models\ParticipantAnswer::select('submitted_on') ->where(['user_id' => $user_id, 'quiz_id' => $quiz_id, 'question_id' => $question_id]) ->first(); @endphp

Lucky Winner

{{ $user->name }}

{{ $user->email }}

{{ $user->city }}

Submitted at: {{ \Carbon\Carbon::parse($submitted_on->submitted_on)->format('h:i:sa') }}

@endif @if (isset($today_scorecard[0]->lucky_winner_2)) @php $user = \App\Models\User::find($today_scorecard[0]->lucky_winner_2); @endphp @if ($user->profile_picture != null) @php $user_score_profile = $user->profile_picture->getUrl(); @endphp @else @php $user_score_profile = '/theme/v2/images/new_logo1.png'; @endphp @endif @php $question_id = $today_scorecard[0]->question_id; $quiz_id = $quiz->id; $user_id = $user->id; $submitted_on = \App\Models\ParticipantAnswer::select('submitted_on') ->where(['user_id' => $user_id, 'quiz_id' => $quiz_id, 'question_id' => $question_id]) ->first(); @endphp

Lucky Winner

{{ $user->name }}

{{ $user->email }}

{{ $user->city }}

Submitted at: {{ \Carbon\Carbon::parse($submitted_on->submitted_on)->format('h:i:sa') }}

@endif
@endif
All Other Participants of {{ \Carbon\Carbon::parse($today ?? $first_date)->format('d M Y') }}
{{-- Question id = {{ $today_scorecard[0]->question_id }} --}} @if ($today_other_participants) {{-- @php dd($today_scorecard[0]->question_id); @endphp --}} @forelse ($today_other_participants as $participant) @php $user = \App\Models\User::find($participant); $date = request()->get('date') ?? null; if ($date) { $score = \App\Models\ParticipantAnswer::where('user_id', $user->id) ->where('quiz_id', $quiz->id) ->where('question_id', $today_scorecard[0]->question_id) ->where('submitted_on', 'LIKE', $date . '%') ->select('point', 'submitted_on') ->orderBy('submitted_on', 'ASC') ->first(); } else { $score = \App\Models\ParticipantAnswer::select('point', 'submitted_on') ->where([ 'user_id' => $user->id, 'quiz_id' => $quiz->id, 'question_id' => $today_scorecard[0]->question_id, ]) ->orderBy('submitted_on', 'ASC') ->first(); } // dd($score->point); @endphp @if ($user->profile_picture != null) @php $user_score_profile = $user->profile_picture->getUrl(); @endphp @else @php $user_score_profile = '/theme/v2/images/new_logo1.png'; @endphp @endif @empty @endforelse @else @endif
Profile Name Score Time Taken Submitted On
profile {{ $user->name }}

City: {{ $user->city ?? 'Data not provided.' }}

{{ $score->point ?? 0 }} @if (isset($score->submitted_on)) @php $start_time = Carbon\Carbon::parse($today_scorecard[0]->start_time)->format('H:i:s'); $submitted_time = Carbon\Carbon::parse($score->submitted_on)->format('H:i:s'); $submitted_time = new DateTime($submitted_time); $start_time = new DateTime($start_time); $time_taken = $start_time->diff($submitted_time); $time_taken = $time_taken->format('%h hour %i min. and %s Sec.'); // $in_hours = intdiv($time_taken, 60).' hour and '. ($time_taken % 60) .' min.'; @endphp {{ $time_taken }} @else Missed this question @endif @if (isset($score->submitted_on)) {{ Carbon\Carbon::parse($score->submitted_on ?? '')->format('d M Y h:ia') }} @else Missed this question @endif
No Other Participants
No Other Participants
All Participants
Sort by score
@forelse ($weekly_scorecard as $participant) @if ($participant->rank_1) @php $user = \App\Models\User::find($participant->user_id); @endphp @if (isset($user->profile_picture)) @php $user_score_profile = $user->profile_picture->getUrl(); @endphp @else @php $user_score_profile = '/theme/v2/images/new_logo1.png'; @endphp @endif @else @endif @empty @endforelse
profile {{ $user->name }}

City: {{ $user->city ?? 'Data not provided.' }}

Total Score

{{ $participant->total }}

No Participants.

No Participants.

All Participants
Sort by score
@forelse ($weekly_scorecard as $participant) @if ($participant->rank_1) @php $user = \App\Models\User::find($participant->user_id); @endphp @if (isset($user->profile_picture)) @php $user_score_profile = $user->profile_picture->getUrl(); @endphp @else @php $user_score_profile = '/theme/v2/images/new_logo1.png'; @endphp @endif @else @endif @empty @endforelse
profile {{ $user->name }}

City: {{ $user->city ?? 'Data not provided.' }}

Total Score

{{ $participant->total }}

No Participants.

No Participants.

All Participants
Sort by score
@forelse ($full_scorecard as $participant) @php $user = \App\Models\User::find($participant->user_id); @endphp @if (isset($user->profile_picture)) @php $user_score_profile = $user->profile_picture->getUrl(); @endphp @else @php $user_score_profile = '/theme/v2/images/new_logo1.png'; @endphp @endif @empty @endforelse
profile {{ $user->name }}

City: {{ $user->city ?? 'Data not provided.' }}

Total Score

{{ $participant->total }}

No Participants.

@auth @endauth @endsection @section('scripts') @endsection