Skip to content

Commit dd3ad33

Browse files
committed
func(Analytics): Expand to highlight who is using checker for rounds.
1 parent e62e7cc commit dd3ad33

File tree

5 files changed

+40
-3
lines changed

5 files changed

+40
-3
lines changed

app/Http/Controllers/AnalyticsController.php

+12-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ class AnalyticsController extends Controller
1313
{
1414
public function index()
1515
{
16+
$this->authorize('update', AccessControl::class);
17+
18+
$cacheName = 'AnalyticsController::index';
1619

1720
$roundsInThePastYear = cache()->remember('rounds_in_the_past_year', 86400, function () {
1821
return Round::where('created_at', '>=', now()->subYear())
@@ -21,7 +24,8 @@ public function index()
2124
->get(['id', 'uuid', 'name']);
2225
});
2326

24-
$stats = cache()->remember('analytics_stats', 86400, function () use ($roundsInThePastYear) {
27+
28+
$stats = cache()->remember($cacheName, 86400, function () use ($roundsInThePastYear) {
2529
$stats = [
2630
'rounds' => 0,
2731
'applications' => 0,
@@ -61,10 +65,17 @@ public function index()
6165
return $stats;
6266
});
6367

68+
// Get a list of rounds that have human evaluators, and pull out the round, together with the humans
69+
$roundsEvaluatedByHumans = Round::whereHas('evaluationAnswers', function ($query) {
70+
$query->with('user');
71+
})->with(['evaluationAnswers' => function ($query) {
72+
$query->with('user')->select('user_id', 'round_id')->groupBy('user_id', 'round_id');
73+
}])->get(['id', 'uuid', 'chain_id', 'name']);
6474

6575
return Inertia::render('Analytics/Index', [
6676
'roundsInThePastYear' => $roundsInThePastYear,
6777
'stats' => $stats,
78+
'roundsEvaluatedByHumans' => $roundsEvaluatedByHumans,
6879
]);
6980
}
7081
}

app/Http/Controllers/ProjectController.php

+1
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ public function index()
7676
$projects = $this->getProjectData();
7777
}
7878

79+
7980
$projects = $projects->paginate();
8081

8182
return Inertia::render('Project/Index', [

app/Http/Controllers/RoundController.php

-1
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,6 @@ public function search($search = null)
220220

221221
public function show(Request $request, Round $round)
222222
{
223-
224223
$this->authorize('view', $round);
225224

226225
$user = auth()->user();

app/Models/Round.php

+5
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,11 @@ public function evaluationQuestions()
7575
return $this->hasOne(RoundApplicationEvaluationQuestions::class);
7676
}
7777

78+
public function evaluationAnswers()
79+
{
80+
return $this->hasMany(RoundApplicationEvaluationAnswers::class);
81+
}
82+
7883
public function gptRoundEligibilityScores()
7984
{
8085
return $this->hasMany(GptRoundEligibilityScore::class);

resources/js/Pages/Analytics/Index.vue

+22-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import TextInput from "@/Components/TextInput.vue";
66
import { Head, useForm, usePage, Link } from "@inertiajs/vue3";
77
88
const stats = ref(usePage().props.stats.valueOf());
9+
const roundsEvaluatedByHumans = ref(usePage().props.roundsEvaluatedByHumans);
910
</script>
1011

1112
<template>
@@ -39,13 +40,33 @@ const stats = ref(usePage().props.stats.valueOf());
3940
using Checker.
4041
</p>
4142

42-
<p>
43+
<p class="mb-5">
4344
{{ stats.roundsEvaluatedByAI }} rounds were evaluated by AI,
4445
evaluating a total of ~{{
4546
stats.roundApplicationsEvaluatedByAI
4647
}}
4748
applications.
4849
</p>
50+
51+
<div>
52+
<h1 class="text-2xl">Round evaluated by humans</h1>
53+
<div
54+
v-for="round in roundsEvaluatedByHumans"
55+
:key="round.uuid"
56+
class="mb-3"
57+
>
58+
<h3>{{ round.name }}</h3>
59+
60+
<ul class="text-xs">
61+
<li
62+
v-for="answer in round.evaluation_answers"
63+
:key="answer.user.id"
64+
>
65+
{{ answer.user.name }} - {{ answer.user.email }}
66+
</li>
67+
</ul>
68+
</div>
69+
</div>
4970
</div>
5071
</div>
5172
</AuthenticatedLayout>

0 commit comments

Comments
 (0)