Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/multisearch' into #147
Browse files Browse the repository at this point in the history
-google-csv-import
  • Loading branch information
krzysztofrewak committed Oct 7, 2024
2 parents d98508c + b67348c commit 626bc10
Show file tree
Hide file tree
Showing 19 changed files with 597 additions and 915 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/deploy-to-beta-by-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
run: echo "BRANCH_NAME=$GITHUB_REF_NAME" >> $GITHUB_ENV

- name: checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
with:
fetch-depth: 0
ref: ${{ env.BRANCH_NAME }}
Expand Down Expand Up @@ -64,7 +64,7 @@ jobs:
context: workflow

- name: build and push image
uses: docker/build-push-action@5cd11c3a4ced054e52742c5fd54dca954e0edd85 # v6.7.0
uses: docker/build-push-action@32945a339266b759abcbdc89316275140b0fc960 # v6.8.0
with:
context: .
file: ./environment/prod/app/Dockerfile
Expand Down Expand Up @@ -103,4 +103,4 @@ jobs:
script: |
cd ${{ env.TARGET_DIR_ON_SERVER }}/${{ env.DOCKER_REGISTRY_REPO_NAME }}/environment/prod/deployment/beta
make beta-deploy SOPS_AGE_KEY=${{ secrets.SOPS_AGE_BETA_SECRET_KEY }}
docker images --filter dangling=true | grep "${{ env.DOCKER_IMAGE_NAME }}" | awk '{print $3}'| xargs --no-run-if-empty docker rmi
docker images --filter dangling=true | grep "${{ env.DOCKER_IMAGE_NAME }}" | awk '{print $3}'| xargs --no-run-if-empty docker rmi 2>/dev/null || true
23 changes: 23 additions & 0 deletions .github/workflows/deploy-to-prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Deploy to production init

concurrency:
group: deploy-prod
cancel-in-progress: false

on:
workflow_dispatch:

jobs:
deploy:
environment: production
runs-on: ubuntu-22.04
name: Deploy to production
env:
DOCKER_REGISTRY: ghcr.io
DOCKER_REGISTRY_USER_NAME: blumilkbot
REPO_NAME: ${{ github.event.repository.name }}
REPO_OWNER: ${{ github.repository_owner }}
TARGET_DIR_ON_SERVER: /blumilk/production
steps:
- name: checkout
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
4 changes: 2 additions & 2 deletions .github/workflows/test-and-lint-js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0

- name: Cache dependencies
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
Expand All @@ -28,7 +28,7 @@ jobs:
restore-keys: ${{ runner.os }}-npm-dependencies

- name: Set up node
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4
with:
node-version: 20

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-and-lint-php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
- 5432:5432

steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0

- name: Validate composer.json and composer.lock
run: composer validate
Expand Down
19 changes: 19 additions & 0 deletions app/Console/Commands/FlushCache.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

declare(strict_types=1);

namespace Keating\Console\Commands;

use Illuminate\Console\Command;

class FlushCache extends Command
{
protected $signature = "cache:flush";
protected $description = "Flush cached data";

public function handle(): void
{
$this->call(FlushCachedPageTitle::class);
$this->call(FlushCachedScheduleLink::class);
}
}
19 changes: 19 additions & 0 deletions app/Console/Commands/FlushCachedScheduleLink.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

declare(strict_types=1);

namespace Keating\Console\Commands;

use Illuminate\Cache\CacheManager;
use Illuminate\Console\Command;

class FlushCachedScheduleLink extends Command
{
protected $signature = "cache:link:flush";
protected $description = "Flush cached schedule link";

public function handle(CacheManager $cache): void
{
$cache->forget("scheduleLink");
}
}
14 changes: 10 additions & 4 deletions app/Http/Controllers/Dashboard/GroupStudentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,22 @@ public function index(Request $request, CourseSemester $course, Group $group): R
$students = $group->students()
->paginate()
->withQueryString();
$availableStudents = $searchText
? Student::query()

$availableStudents = match(true) {
$searchText === null => [],
preg_match("/^(\d+\s?)+$/", $searchText) === 1 => Student::query()
->whereNotIn("id", $group->students->pluck("id"))
->whereIn("index_number", explode(" ", $searchText))
->get(),
default => Student::query()
->whereNotIn("id", $group->students->pluck("id"))
->where(
fn(Builder $query): Builder => $query
->where("first_name", "ILIKE", "%$searchText%")
->orWhere("surname", "ILIKE", "%$searchText%")
->orWhere("index_number", "LIKE", "%$searchText%"),
)->get()
: [];
)->get(),
};

return inertia("Dashboard/CourseSemester/Student/Index", [
"course" => CourseSemesterData::fromModel($course),
Expand Down
3 changes: 3 additions & 0 deletions app/Models/Group.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
* @property Collection<GradeColumn> gradeColumns
* @property Carbon $created_at
* @property Carbon $updated_at
* @property-read CourseSemester $course
* @property-read Collection<Student> $students
* @property-read Collection<GradeColumn> $gradeColumns
*/
class Group extends Model
{
Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@
"fakerphp/faker": "^1.23.1",
"guzzlehttp/guzzle": "^7.9.2",
"inertiajs/inertia-laravel": "^1.3",
"laravel/framework": "^11.21.0",
"laravel/framework": "^11.25.0",
"laravel/sanctum": "^4.0.2",
"laravel/tinker": "^2.9",
"laravel/tinker": "^2.10.0",
"spatie/laravel-options": "^1.1.1",
"stevebauman/purify": "^6.2.1"
"stevebauman/purify": "^6.2.2"
},
"require-dev": {
"blumilksoftware/codestyle": "^3.3",
"mockery/mockery": "^1.6.12",
"nunomaduro/collision": "^8.4.0",
"phpunit/phpunit": "^11.3.1",
"phpunit/phpunit": "^11.3.6",
"spatie/laravel-ignition": "^2.8"
},
"autoload": {
Expand Down
Loading

0 comments on commit 626bc10

Please sign in to comment.