Skip to content

Commit cc66020

Browse files
committed
Merge branch 'staging' into deployment
2 parents 3ca27bf + 430ae5e commit cc66020

File tree

71 files changed

+1552
-314
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+1552
-314
lines changed

.devcontainer/devcontainer.json

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,16 @@
66
],
77
"service": "mars_dev",
88
"workspaceFolder": "/workspace/mars",
9-
"settings": {},
10-
"extensions": [
11-
// "mikestead.dotenv",
12-
// "amiralizadeh9480.laravel-extra-intellisense",
13-
// "ryannaddy.laravel-artisan",
14-
// "onecentlin.laravel5-snippets",
15-
// "onecentlin.laravel-blade"
16-
],
9+
"customizations": {
10+
"vscode": {
11+
"settings": {
12+
"php-cs-fixer.executablePath": "${workspaceFolder}/vendor/bin/php-cs-fixer"
13+
},
14+
"extensions": [
15+
"junstyle.php-cs-fixer"
16+
]
17+
}
18+
},
1719
"remoteUser": "ubuntu",
1820
"postCreateCommand": "make build"
1921
// "forwardPorts": [],

Makefile

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,11 @@ seed:
1010
php artisan db:seed
1111

1212
serve:
13-
php artisan serve --host=0.0.0.0
13+
php artisan serve --host=0.0.0.0
14+
15+
clear_cache:
16+
php artisan cache:clear
17+
php artisan view:clear
18+
php artisan config:clear
19+
php artisan event:clear
20+
php artisan route:clear
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?php
2+
3+
namespace App\Console\Commands;
4+
5+
use Illuminate\Console\Command;
6+
use App\Http\Controllers\Secretariat\SemesterEvaluationController;
7+
use Illuminate\Support\Facades\App;
8+
use App\Models\Semester;
9+
10+
class FinalizeSemesterEvaluation extends Command
11+
{
12+
/**
13+
* The name and signature of the console command.
14+
*
15+
* @var string
16+
*/
17+
protected $signature = 'app:finalize-semester-evaluation {year} {part}';
18+
19+
/**
20+
* The console command description.
21+
*
22+
* @var string
23+
*/
24+
protected $description = 'Finalizes the semester evaluation, deactivates collegists who has not set their new status.';
25+
26+
/**
27+
* Execute the console command.
28+
*/
29+
public function handle()
30+
{
31+
$year = $this->argument('year');
32+
$part = $this->argument('part');
33+
34+
35+
$semester = Semester::where('year', $year)->where('part', $part)->first();
36+
37+
App::setLocale('hu');
38+
app(SemesterEvaluationController::class)->finalize($semester);
39+
}
40+
}

app/Http/Controllers/Dormitory/Printing/PrintJobController.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ private function paginatorFrom(Builder $printJobs, array $columns)
179179
$paginator = TabulatorPaginator::from($printJobs)->sortable($columns)->filterable($columns)->paginate();
180180

181181
// Process the data before showing it in a table.
182+
// @phpstan-ignore-next-line
182183
$paginator->getCollection()->append([
183184
'translated_cost',
184185
'translated_state',

app/Http/Controllers/Secretariat/SemesterEvaluationController.php

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -89,17 +89,17 @@ public function handlePeriodicEventStart(): void
8989
public function handlePeriodicEventReminder(int $daysBeforeEnd): void
9090
{
9191
if($daysBeforeEnd < 3) {
92-
$userCount = $this->usersHaventFilledOutTheForm()->count();
92+
$userCount = SemesterEvaluationController::usersHaventFilledOutTheForm($this->semester())->count();
9393
Mail::to(config('contacts.mail_membra'))->queue(new EvaluationFormReminder($userCount, $this->getDeadline()));
9494
}
9595
}
9696

9797
/**
9898
* Send email about results and deactivate collegists who did not fill out the form.
9999
*/
100-
public function handlePeriodicEventEnd()
100+
public static function finalize($semester)
101101
{
102-
$users = $this->usersHaventFilledOutTheForm();
102+
$users = SemesterEvaluationController::usersHaventFilledOutTheForm($semester);
103103
$users_names = $users->pluck('name')->toArray();
104104

105105
if (User::secretary()) {
@@ -137,7 +137,6 @@ public function show()
137137
$this->authorize('fillOrManage', SemesterEvaluation::class);
138138

139139
return view('secretariat.evaluation-form.app', [
140-
'phd' => user()->educationalInformation->isSenior(),
141140
'user' => user(),
142141
'faculties' => Faculty::all(),
143142
'workshops' => Workshop::all(),
@@ -146,7 +145,7 @@ public function show()
146145
'community_services' => user()->communityServiceRequests()->where('semester_id', Semester::current()->id)->get(),
147146
'position_roles' => user()->roles()->whereIn('name', Role::STUDENT_POSTION_ROLES)->get(),
148147
'periodicEvent' => $this->periodicEvent(),
149-
'users_havent_filled_out' => user()->can('manage', SemesterEvaluation::class) ? $this->usersHaventFilledOutTheForm() : null,
148+
'users_havent_filled_out' => user()->can('manage', SemesterEvaluation::class) ? SemesterEvaluationController::usersHaventFilledOutTheForm($this->semester()) : null,
150149
]);
151150
}
152151

@@ -243,11 +242,17 @@ public function store(Request $request)
243242
/**
244243
* @return User[]|\Illuminate\Database\Eloquent\Collection|\Illuminate\Support\Collection
245244
*/
246-
public function usersHaventFilledOutTheForm()
245+
public static function usersHaventFilledOutTheForm($semester)
247246
{
248-
return User::withRole(Role::COLLEGIST)->verified()->whereDoesntHave('semesterStatuses', function ($query) {
249-
$query->where('semester_id', $this->semester()?->succ()?->id);
250-
})->get();
247+
return User::withRole(Role::COLLEGIST)
248+
->whereDoesntHave('roles', function ($query) {
249+
$query->where('name', Role::SENIOR);
250+
})
251+
->verified()
252+
->whereDoesntHave('semesterStatuses', function ($query) use ($semester) {
253+
$query->where('semester_id', $semester?->succ()?->id);
254+
})
255+
->get();
251256
}
252257

253258
/**

app/Http/Controllers/Secretariat/UserController.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ public function updateEducationalInformation(Request $request, User $user): Redi
169169
'study_lines' => 'array',
170170
'study_lines.*.name' => 'required|string|max:255',
171171
'study_lines.*.level' => ['required', Rule::in(array_keys(StudyLine::TYPES))],
172+
'study_lines.*.training_code' => 'string|max:255',
172173
'study_lines.*.minor' => 'nullable|string|max:255',
173174
'study_lines.*.start' => 'required',
174175
'email' => [
@@ -209,7 +210,6 @@ public function updateEducationalInformation(Request $request, User $user): Redi
209210

210211
if ($request->has('workshop')) {
211212
$user->workshops()->sync($request->input('workshop'));
212-
WorkshopBalance::generateBalances(Semester::current());
213213
}
214214

215215
if ($request->has('faculty')) {
@@ -223,6 +223,7 @@ public function updateEducationalInformation(Request $request, User $user): Redi
223223
'name' => $studyLine["name"],
224224
'type' => $studyLine["level"],
225225
'minor' => $studyLine["minor"] ?? null,
226+
'training_code' => $studyLine["training_code"],
226227
'start' => $studyLine["start"],
227228
'end' => $studyLine["end"] ?? null,
228229
]);

app/Http/Controllers/StudentsCouncil/EconomicController.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,6 @@ public static function payKKTNetregLogic(User $payer, User $receiver, int $kkt_a
105105
'moved_to_checkout' => null,
106106
]);
107107

108-
WorkshopBalance::generateBalances(Semester::current());
109-
110108
$new_expiry_date = $payer->internetAccess->extendInternetAccess();
111109

112110
return [$kkt, $netreg, $new_expiry_date];

app/Models/EducationalInformation.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use Illuminate\Database\Eloquent\Relations\HasMany;
99

1010
use App\Models\Semester;
11+
use App\Models\Role;
1112

1213
/**
1314
* Either B2 or C1.
@@ -113,11 +114,11 @@ public function languageExamsBeforeAcceptance()
113114
}
114115

115116
/**
116-
* Whether the user is a senior (i.e. currently has a PhD study line).
117+
* Whether the user is a senior
117118
*/
118119
public function isSenior(): bool
119120
{
120-
return $this->studyLines()->currentlyEnrolled()->where('type', 'phd')->exists();
121+
return $this->user->isSenior();
121122
}
122123

123124
/**

app/Models/FreePages.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public function printAccount()
7777

7878
/**
7979
* Wether the free pages are still available.
80-
* @return bool
80+
* @return Attribute
8181
*/
8282
protected function available(): Attribute
8383
{

app/Models/PrintAccount.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public function freePages()
6969

7070
/**
7171
* The free pages which are currently available. Sorts the free pages by their deadline.
72-
* @return Collection
72+
* @return Collection|FreePages[]
7373
*/
7474
public function availableFreePages()
7575
{
@@ -131,7 +131,7 @@ public function updateHistory(bool $useFreePages, int $cost)
131131
$availableFreePages = $this->availableFreePages()->where('amount', '>', 0);
132132

133133
// Subtract the pages from the free pages pool, as many free pages as necessary
134-
/** @var FreePages */
134+
/** @var FreePages $freePages */
135135
foreach ($availableFreePages as $freePages) {
136136
$subtractablePages = $freePages->calculateSubtractablePages($freePagesToSubtract);
137137
$freePages->subtractPages($subtractablePages);

0 commit comments

Comments
 (0)