Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,4 @@ _ide_helper_models.php
*.DS_Store
.vscode
.php-cs-fixer.cache
/composer.phar
16 changes: 9 additions & 7 deletions app/Http/Controllers/Auth/AdmissionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@

public function __construct()
{
$this->underlyingControllerName =
\App\Http\Controllers\Auth\ApplicationController::class;
$this->underlyingControllerName
= \App\Http\Controllers\Auth\ApplicationController::class;
}

/**
Expand Down Expand Up @@ -80,7 +80,7 @@
{
$request->validate([
'status_filter' => 'in:everybody,unsubmitted,submitted,called_in,admitted',
'return_excel' => 'nullable|boolean'
'return_excel' => 'nullable|boolean',
]);
$authUser = $request->user();
$this->authorize('viewSome', Application::class);
Expand Down Expand Up @@ -132,7 +132,7 @@
'workshops' => \App\Policies\ApplicationPolicy::getAccessibleWorkshops($authUser), //workshops that can be chosen to filter
'status_filter' => $status_filter,
'applicationDeadline' => $this->getDeadline(),
'periodicEvent' => $this->periodicEvent()
'periodicEvent' => $this->periodicEvent(),
]);
}

Expand Down Expand Up @@ -177,15 +177,15 @@
$this->authorize('editSubmissionStatus', Application::class);
$application->update(
[
"submitted" => 1
"submitted" => 1,
]
);
}
if ($request->has('unsubmit')) {
$this->authorize('editSubmissionStatus', Application::class);
$application->update(
[
"submitted" => 0
"submitted" => 0,
]
);
}
Expand All @@ -204,7 +204,7 @@
$admitted = $this->getAdmitted();
return view('auth.admission.finalize', [
'semester' => $this->semester(),
'admitted_applications' => $admitted
'admitted_applications' => $admitted,
]);
}

Expand Down Expand Up @@ -243,6 +243,7 @@
// soft deletes application, keep them for future reference
// (see https://github.com/EotvosCollegium/mars/issues/332#issuecomment-2014058021)
$application->delete();
$application->applicationWorkshops()->delete();
Comment thread
viktorcsimma marked this conversation as resolved.
} else {
$files = File::where('application_id', $application->id)
->orWhere('user_id', $application->user->id);
Expand All @@ -252,6 +253,7 @@
$files->delete();
$application->forceDelete();
$application->user->forceDelete();
$application->applicationWorkshops()->forceDelete();
}
}

Expand Down Expand Up @@ -284,6 +286,6 @@
{
$admitted = Application::query()->with(['user', 'applicationWorkshops'])->admitted()->get()->sortBy('user.name');

return $admitted;

Check failure on line 289 in app/Http/Controllers/Auth/AdmissionController.php

View workflow job for this annotation

GitHub Actions / phpunit

Method App\Http\Controllers\Auth\AdmissionController::getAdmitted() should return array but returns Illuminate\Database\Eloquent\Collection<int, App\Models\Application>.

Check failure on line 289 in app/Http/Controllers/Auth/AdmissionController.php

View workflow job for this annotation

GitHub Actions / phpunit

Method App\Http\Controllers\Auth\AdmissionController::getAdmitted() should return array but returns Illuminate\Database\Eloquent\Collection<int, App\Models\Application>.
}
}
64 changes: 32 additions & 32 deletions app/Models/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class Application extends Model
'present',
'publication_consent',
'pseudonym',
'note'
'note',
];

protected $casts = [
Expand All @@ -112,7 +112,7 @@ class Application extends Model
"kari, egyetemi nyílt napon vagy hasonló rendezvényen láttam",
"a Facebook/Instagram hirdetést láttam",
"egy Facebook oldalon vagy csoportban posztolták",
"az ELTE honlapján olvastam róla"
"az ELTE honlapján olvastam róla",
];

/*
Expand All @@ -132,7 +132,7 @@ public function user(): BelongsTo


/**
* The ApplicationWorkshop models that the user applied for (includes status of application).
* ApplicationWorkshop is a pivot class that includes status of application.
*/
public function applicationWorkshops(): HasMany
{
Expand All @@ -141,7 +141,7 @@ public function applicationWorkshops(): HasMany


/**
* The Workshop models that the user applied for.
* This points to the 'real' Workshop class (not the pivoting element).
* @return HasManyThrough
*/
public function appliedWorkshops(): HasManyThrough
Expand Down Expand Up @@ -253,7 +253,7 @@ public function scopeVisibleToCurrentUser(Builder $query): Builder
protected function admitted(): Attribute
{
return Attribute::make(
get: fn () => $this->applicationWorkshops()->where('admitted', true)->exists(),
get: fn() => $this->applicationWorkshops()->where('admitted', true)->exists(),
);
}

Expand All @@ -266,7 +266,7 @@ protected function admitted(): Attribute
protected function calledIn(): Attribute
{
return Attribute::make(
get: fn () => $this->applicationWorkshops()->where('called_in', true)->exists(),
get: fn() => $this->applicationWorkshops()->where('called_in', true)->exists(),
);
}

Expand All @@ -278,8 +278,8 @@ protected function calledIn(): Attribute
protected function semesterAverage(): Attribute
{
return Attribute::make(
get: fn ($value) => DataCompresser::decompressData($value),
set: fn ($value) => DataCompresser::compressData($value),
get: fn($value) => DataCompresser::decompressData($value),
set: fn($value) => DataCompresser::compressData($value),
);
}

Expand All @@ -291,8 +291,8 @@ protected function semesterAverage(): Attribute
protected function languageExam(): Attribute
{
return Attribute::make(
get: fn ($value) => DataCompresser::decompressData($value),
set: fn ($value) => DataCompresser::compressData($value),
get: fn($value) => DataCompresser::decompressData($value),
set: fn($value) => DataCompresser::compressData($value),
);
}

Expand All @@ -304,8 +304,8 @@ protected function languageExam(): Attribute
public function competition(): Attribute
{
return Attribute::make(
get: fn ($value) => DataCompresser::decompressData($value),
set: fn ($value) => DataCompresser::compressData($value),
get: fn($value) => DataCompresser::decompressData($value),
set: fn($value) => DataCompresser::compressData($value),
);
}

Expand All @@ -317,8 +317,8 @@ public function competition(): Attribute
public function publication(): Attribute
{
return Attribute::make(
get: fn ($value) => DataCompresser::decompressData($value),
set: fn ($value) => DataCompresser::compressData($value),
get: fn($value) => DataCompresser::decompressData($value),
set: fn($value) => DataCompresser::compressData($value),
);
}

Expand All @@ -330,8 +330,8 @@ public function publication(): Attribute
public function foreignStudies(): Attribute
{
return Attribute::make(
get: fn ($value) => DataCompresser::decompressData($value),
set: fn ($value) => DataCompresser::compressData($value),
get: fn($value) => DataCompresser::decompressData($value),
set: fn($value) => DataCompresser::compressData($value),
);
}

Expand All @@ -343,8 +343,8 @@ public function foreignStudies(): Attribute
public function question1(): Attribute
{
return Attribute::make(
get: fn ($value) => DataCompresser::decompressData($value),
set: fn ($value) => DataCompresser::compressData($value),
get: fn($value) => DataCompresser::decompressData($value),
set: fn($value) => DataCompresser::compressData($value),
);
}

Expand All @@ -356,7 +356,7 @@ public function question1(): Attribute
public function question1Custom(): Attribute
{
return Attribute::make(
get: fn (): string => $this->getCustomValue($this->question_1, self::QUESTION_1)
get: fn(): string => $this->getCustomValue($this->question_1, self::QUESTION_1)
);
}

Expand Down Expand Up @@ -401,14 +401,14 @@ public function missingData(): array
$missingData[] = 'Személyes adat: e-mail';
}
foreach (['place_of_birth', 'date_of_birth', 'mothers_name', 'phone_number',
'country', 'county', 'zip_code', 'city', 'street_and_number'] as $personal_info_field) {
'country', 'county', 'zip_code', 'city', 'street_and_number'] as $personal_info_field) {
if (!isset($personalInformation) || !isset($personalInformation[$personal_info_field])) {
$missingData[] = "Személyes adat: ".strtolower(__('user.'.$personal_info_field));
$missingData[] = "Személyes adat: " . strtolower(__('user.' . $personal_info_field));
}
}
foreach (['high_school', 'year_of_graduation', 'year_of_acceptance', 'neptun'] as $educational_info_field) {
if (!isset($educationalInformation) || !isset($educationalInformation[$educational_info_field])) {
$missingData[] = "Tanulmányi adat: ".strtolower(__('user.'.$educational_info_field));
$missingData[] = "Tanulmányi adat: " . strtolower(__('user.' . $educational_info_field));
}
}

Expand All @@ -422,16 +422,22 @@ public function missingData(): array
} else {
foreach ($educationalInformation->studyLines as $study_line) {
if (!isset($study_line['name'])) {
$missingData[] = 'Tanulmányi adat: valamely tanult szak adata: '.strtolower(__('user.study_line'));
$missingData[] = 'Tanulmányi adat: valamely tanult szak adata: ' . strtolower(__('user.study_line'));
}
if (!isset($study_line['type'])) {
$missingData[] = 'Tanulmányi adat: valamely tanult szak adata: '.strtolower(__('user.study_line_level'));
$missingData[] = 'Tanulmányi adat: valamely tanult szak adata: ' . strtolower(__('user.study_line_level'));
}
if (!isset($study_line['training_code'])) {
$missingData[] = 'Tanulmányi adat: valamely tanult szak adata: '.strtolower(__('user.study_line_training_code'));
$missingData[] = 'Tanulmányi adat: valamely tanult szak adata: ' . strtolower(__('user.study_line_training_code'));
}
if (!isset($study_line['start'])) {
$missingData[] = 'Tanulmányi adat: valamely tanult szak adata: '.strtolower(__('user.study_line_start'));
$missingData[] = 'Tanulmányi adat: valamely tanult szak adata: ' . strtolower(__('user.study_line_start'));
}
}

foreach (FileType::cases() as $type) { // for this, we need to have study lines
if ($this->needsFile($type) && !$this->filesOfType($type)->exists()) {
$missingData[] = 'Szükséges dokumentum: ' . __('document.file_types.' . $type->value, [], 'hu');
}
}
}
Expand Down Expand Up @@ -473,12 +479,6 @@ public function missingData(): array
$missingData[] = 'Szakmai és motivációs kérdések: jelige';
}

foreach (FileType::cases() as $type) {
if ($this->needsFile($type) && !$this->filesOfType($type)->exists()) {
$missingData[] = 'Szükséges dokumentum: ' . __('document.file_types.' . $type->value, [], 'hu');
}
}

return $missingData;
}

Expand Down
7 changes: 5 additions & 2 deletions app/Models/ApplicationWorkshop.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
use Illuminate\Database\Eloquent\Relations\Pivot;
use Illuminate\Database\Eloquent\Relations\BelongsTo;

/**
* A pivot class between users and the workshops they apply for.
*/
class ApplicationWorkshop extends Pivot
{
use HasFactory;
Expand All @@ -16,12 +19,12 @@ class ApplicationWorkshop extends Pivot
'workshop_id',
'application_id',
'called_in',
'admitted'
'admitted',
];

protected $casts = [
'called_in' => 'bool',
'admitted' => 'bool'
'admitted' => 'bool',
];

/**
Expand Down
12 changes: 11 additions & 1 deletion resources/lang/en/document.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,15 @@
'printing_first' => 'You can print documents here, and the cost will be deducted from your printing account (printing configuration: :printing_conf_name_eng, your balance: HUF :current_balance). If you want to use different settings (e.g., use free printing credits or print multiple copies), download the document and upload it on the [printing page](:printing_page_url).',
'register-statement' => 'Registration statement',
'request' => 'Request',
'status-cert' => 'Status certificate'
'status-cert' => 'Status certificate',
'file_types' => [
'profile_picture' => 'Profile picture',
'receipt' => 'Receipt',
'resume' => 'Resumé',
'besorolasi_hatarozat' => '',
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated
'erettsegi' => 'Secondary school certificate',
'elvegzett_felev' => 'Certificate about previous semesters',
'diploma' => 'Diploma',
'application_custom' => 'Other documents, certificates',
],
];
Loading
Loading