Skip to content

Commit 118b5c2

Browse files
committed
Fragencounter aktualisiert
1 parent a4b2c52 commit 118b5c2

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

src/app/Http/Livewire/Question.php

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,19 @@ public function render()
6464
}
6565

6666
private function calculateStats(): void{
67-
$this->answered = auth()->user()->answeredTasks()->whereRAW('DATE(answered_at) = CURDATE()')->count();
68-
$this->answered_correctly = auth()->user()->answeredTasks()->whereRAW('DATE(answered_at) = CURDATE()')->where('answered_correctly', true)->count();
67+
$this->answered = auth()->user()
68+
->answeredTasks()
69+
->whereRAW('DATE(answered_at) = CURDATE()')
70+
->join('tasks', 'answered_tasks.task_id', 'tasks.id')
71+
->where('license_id', $this->license->id)
72+
->count();
73+
$this->answered_correctly = auth()->user()
74+
->answeredTasks()
75+
->whereRAW('DATE(answered_at) = CURDATE()')
76+
->join('tasks', 'answered_tasks.task_id', 'tasks.id')
77+
->where('license_id', $this->license->id)
78+
->where('answered_correctly', true)
79+
->count();
6980
}
7081

7182
private function assignTask(): void

src/resources/views/livewire/question.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ class="flex items-center w-full px-6 py-3 text-xs font-semibold tracking-widest
8484
</div>
8585

8686
<div class="pt-5 text-sm text-center text-gray-500">
87-
Du hast heute schon {{ $answered }} Fragen beantwortet. Davon hast du {{ $answered_correctly }} richtig beantwortet.
87+
Du hast heute schon <b>{{ $answered }}</b> Fragen in der Kategorie <em>{{ $license->name }}</em> beantwortet. <br>Davon hast du <b>{{ $answered_correctly }}</b> richtig beantwortet.
8888
</div>
8989

9090

0 commit comments

Comments
 (0)