Skip to content

Commit 69fb7c7

Browse files
authored
Merge pull request #2567 from codeeu/dev
Temp fix to issues with certs
2 parents 6c11624 + a415af9 commit 69fb7c7

File tree

2 files changed

+17
-21
lines changed

2 files changed

+17
-21
lines changed
Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
11
<?php
22

3+
/**
4+
* @Author: Bernard Hanna
5+
* @Date: 2025-01-29 14:25:28
6+
* @Last Modified by: Bernard Hanna
7+
* @Last Modified time: 2025-03-13 17:52:44
8+
*/
9+
310
namespace App\Http\Controllers;
411

512
use App\CertificateExcellence;
613
use App\Excellence;
714
use App\Queries\ExcellenceQuery;
8-
use Gate;
915
use Illuminate\Http\RedirectResponse;
1016
use Illuminate\Http\Request;
1117
use Illuminate\View\View;
@@ -14,27 +20,11 @@ class ExcellenceController extends Controller
1420
{
1521
public function report($edition): View
1622
{
17-
18-
// Check if user is a winner for this edition
19-
if (Gate::denies('report-excellence', $edition)) {
20-
// The current user can't report for excellence...
21-
abort(403, 'You are not eligible to receive a Codeweek4All Excellence Certificate.');
22-
23-
}
24-
2523
return view('excellence.report', compact('edition'));
26-
2724
}
2825

2926
public function generate($edition, Request $request): RedirectResponse
3027
{
31-
32-
if (Gate::denies('report-excellence', $edition)) {
33-
// The current user can't report for excellence...
34-
abort(403, 'You are not eligible to receive a Codeweek4All Excellence Certificate.');
35-
36-
}
37-
3828
$rules = [
3929
'name_for_certificate' => 'required|max:40|regex:/^[^ə]*$/u',
4030
];
@@ -56,6 +46,5 @@ public function generate($edition, Request $request): RedirectResponse
5646
]);
5747

5848
return redirect('certificates');
59-
6049
}
6150
}

app/Queries/ReportableEventsQuery.php

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
11
<?php
2+
3+
/**
4+
* @Author: Bernard Hanna
5+
* @Date: 2025-01-29 14:25:28
6+
* @Last Modified by: Bernard Hanna
7+
* @Last Modified time: 2025-03-12 17:57:08
8+
*/
9+
10+
211
/**
312
* Created by PhpStorm.
413
* User: doris
@@ -25,17 +34,15 @@ public static function reportable()
2534
})
2635
->where('start_date', '<=', Carbon::now())
2736
->orderBy('end_date', 'desc')->paginate(20);
28-
2937
}
3038

3139
public static function reported()
3240
{
3341

3442
return Event::where('status', 'APPROVED')
3543
->where('creator_id', '=', Auth::user()->id)
36-
->where('reported_at', '<>', null)
44+
->whereNotNull('reported_at')
3745
->where('start_date', '<=', Carbon::now())
3846
->orderBy('created_at', 'desc')->paginate(20);
39-
4047
}
4148
}

0 commit comments

Comments
 (0)