Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 4 additions & 0 deletions app/Http/Controllers/ProfilesApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ public function index(ProfilesApiRequest $request): JsonResponse
$profile = $profile->withAnyTags(explode(';', $request->tag), Profile::class);
}

if ($request->boolean('accepting_undergrad')) {
$profile = $profile->acceptingUndergradStudents();
}

if ($request->boolean('with_data')) {
if(count(array_filter($request->query())) <=1){
return response()->json(['error' => 'Please use a filter when pulling data.'], 400);
Expand Down
18 changes: 18 additions & 0 deletions app/Profile.php
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,24 @@ public function scopeStudentsPendingReviewWithSemester($query, $semester)
$query_students->WithStatusPendingReview();
});
}
/**
* Query scope for Profiles that are accepting undergrad students,
* i.e. not marked as "Not accepting undergrad students" nor "Not accepting students".
*
* @param \Illuminate\Database\Eloquent\Builder $query
* @return \Illuminate\Database\Eloquent\Builder
*/
public function scopeAcceptingUndergradStudents($query) {
return $query
->whereDoesntHave("information", function ($q) {
$q->whereJsonContains("data->not_accepting_students", "1");
})
->whereDoesntHave("information", function ($q) {
$q->whereJsonContains("data->show_not_accepting_students", "1")
->whereJsonContains("data->not_accepting_students", "0")
->whereJsonContains("data->not_accepting_grad_students", "0");
});
}

///////////////////////////////////
// Mutators & Virtual Attributes //
Expand Down
3 changes: 3 additions & 0 deletions public/js/app.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion public/mix-manifest.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"/js/app.js": "/js/app.js?id=24be537863fbbe2259218dfb56ecef72",
"/js/app.js": "/js/app.js?id=3968f8a7c8b8f9af96296f3b18ea02c0",
"/js/manifest.js": "/js/manifest.js?id=dc9ead3d7857b522d7de22d75063453c",
"/css/app.css": "/css/app.css?id=bff46e69abe7a97b008296b99e4abadd",
"/js/vendor.js": "/js/vendor.js?id=4d3313683b3a2faf8ca0278ce47f3880"
Expand Down
4 changes: 4 additions & 0 deletions resources/assets/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,10 @@ var profiles = (function ($, undefined) {
api += '&from_school=' + $select.data('school');
}

if ($select.data('accepting-undergrad')) {
api += '&accepting_undergrad=' + $select.data('accepting-undergrad');
}

let profileSearch = new Bloodhound({
datumTokenizer: (profiles) => Bloodhound.tokenizers.whitespace(profiles.value),
queryTokenizer: Bloodhound.tokenizers.whitespace,
Expand Down
1 change: 1 addition & 0 deletions resources/views/students/form.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
'aria-labelledby' => 'profiles-picker-label',
'multiple',
'required',
'data-accepting-undergrad' => 'true',
] + ($schools->isNotEmpty() ? ['data-school' => $schools->keys()->implode(';')] : []))
!!}
@else
Expand Down
Loading