Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Course Management System - Release 2.1.0 #202

Merged
merged 36 commits into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
4785493
Code cleanup
NuwanJ Oct 11, 2024
eb37c18
Remove warning log, due to it is not a warning
NuwanJ Oct 12, 2024
cefce48
[npm] Bump @fortawesome/fontawesome-free from 5.15.4 to 6.6.0 (#176)
dependabot[bot] Oct 14, 2024
249c532
[npm] Bump sass-loader from 8.0.2 to 16.0.2 (#175)
dependabot[bot] Oct 14, 2024
69cb896
Merge branch 'course-management-system' into release-2.1.0
NuwanJ Oct 16, 2024
d40c5c8
Removed duplicates
NuwanJ Oct 16, 2024
267ff30
[composer] Update intervention/image requirement from ^2.6 to ^3.8 (#…
dependabot[bot] Oct 16, 2024
c818d21
[npm] Bump @coreui/icons from 1.0.1 to 3.0.1 (#10)
dependabot[bot] Oct 16, 2024
0317025
[npm] Bump jquery from 3.6.0 to 3.7.1 (#7)
dependabot[bot] Oct 16, 2024
edc41a1
[npm] Bump resolve-url-loader from 3.1.5 to 5.0.0 (#4)
dependabot[bot] Oct 16, 2024
e37c74a
pnpm lock updated
NuwanJ Oct 16, 2024
856e523
Semesters can be sorted by URL
NuwanJ Oct 17, 2024
7fa0410
[npm] Bump resolve-url-loader from 3.1.5 to 5.0.0 (#196)
dependabot[bot] Oct 21, 2024
1719e59
[npm] Bump axios from 0.21.4 to 1.7.7 (#194)
dependabot[bot] Oct 21, 2024
d1d404d
Course management system - Release 2.1.0 (#167)
NuwanJ Oct 23, 2024
7220195
Workflow fixes
NuwanJ Oct 23, 2024
2759f23
Formatting fixes
NuwanJ Oct 23, 2024
ec729fb
Composer Update
NuwanJ Oct 23, 2024
a5a5fcc
UI changes
NuwanJ Oct 23, 2024
28cf9c3
Title for item added
NuwanJ Oct 23, 2024
89218df
Add more types for marks allocation
NuwanJ Oct 23, 2024
3c8b823
Course type filter correction
NuwanJ Oct 23, 2024
6a22ae3
UI fix
NuwanJ Oct 23, 2024
d1dcf41
Permission updates
NuwanJ Oct 24, 2024
0fae926
Deploy dev script update
NuwanJ Oct 24, 2024
2135f7d
fix: preserve state of prerequisite adder even formstep changes for c…
IsharaEkanayaka Oct 24, 2024
9d7f801
Adding missing ;
NuwanJ Oct 24, 2024
7df1cf6
favicon.png update
NuwanJ Nov 1, 2024
246f5a5
Composer update
NuwanJ Nov 1, 2024
c1369f9
User account creation logic changes
NuwanJ Nov 4, 2024
498ba1c
Adding doctrine/dbal
NuwanJ Nov 4, 2024
1008354
Adding badges to readme
NuwanJ Nov 4, 2024
b49fac2
[Bug] if course type is foundation it cant be created db issue 210 (…
NuwanJ Nov 5, 2024
ddf00dd
Prod script update
NuwanJ Nov 7, 2024
4df01a3
Event sorting correction
NuwanJ Nov 7, 2024
8753ec2
Contributors - UI changes
NuwanJ Nov 8, 2024
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
17 changes: 10 additions & 7 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,23 @@ LOG_LEVEL=debug
LOG_DISCORD_WEBHOOK_URL=

# Drivers
DB_CONNECTION=mysql
BROADCAST_DRIVER=log
CACHE_DRIVER=file
FILESYSTEM_DRIVER=local
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120

# Database
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=laravel
DB_USERNAME=root
DB_PASSWORD=
# Database - SQLlite
DB_CONNECTION=sqlite
DB_DATABASE=database/database.sqlite

# DB_CONNECTION=mysql
# DB_HOST=127.0.0.1
# DB_PORT=3306
# DB_DATABASE=laravel
# DB_USERNAME=root
# DB_PASSWORD=

# Cache
MEMCACHED_HOST=127.0.0.1
Expand Down
11 changes: 11 additions & 0 deletions .github/workflows/laravel_pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ on:
jobs:
laravel-tests:
runs-on: ubuntu-latest
env:
DB_CONNECTION: sqlite
DB_DATABASE: database/database.sqlite

steps:
- uses: shivammathur/setup-php@15c43e89cdef867065b0213be354c2841860869e
Expand All @@ -20,9 +23,17 @@ jobs:
- name: Copy .env
run: php -r "file_exists('.env') || copy('.env.example', '.env');"

- name: Remove existing composer.lock
run: rm ./composer.lock

- name: Install Dependencies
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist

- name: Create Database
run: |
mkdir -p database
touch database/database.sqlite

- name: Generate key
run: php artisan key:generate

Expand Down
22 changes: 15 additions & 7 deletions .github/workflows/laravel_push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on: [push]
jobs:
laravel-tests:
runs-on: ubuntu-latest
env:
DB_CONNECTION: sqlite
DB_DATABASE: database/database.sqlite

steps:
- uses: shivammathur/setup-php@15c43e89cdef867065b0213be354c2841860869e
Expand All @@ -13,19 +16,24 @@ jobs:
- uses: actions/checkout@v2
- name: Copy .env
run: php -r "file_exists('.env') || copy('.env.example', '.env');"

- name: Remove existing composer.lock
run: rm ./composer.lock

- name: Install Dependencies
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
- name: Generate key
run: php artisan key:generate
- name: Directory Permissions
run: chmod -R 777 storage bootstrap/cache

- name: Create Database
run: |
mkdir -p database
touch database/database.sqlite

- name: Generate key
run: php artisan key:generate

- name: Directory Permissions
run: chmod -R 777 storage bootstrap/cache

- name: Execute tests (Unit and Feature tests) via PHPUnit
env:
DB_CONNECTION: sqlite
DB_DATABASE: database/database.sqlite
run: |
php artisan test -p --colors --debug
14 changes: 10 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
[![Laravel CI](https://github.com/cepdnaclk/portal.ce.pdn.ac.lk/actions/workflows/laravel_push.yml/badge.svg)](https://github.com/cepdnaclk/portal.ce.pdn.ac.lk/actions/workflows/laravel_push.yml) ![GitHub Release](https://img.shields.io/github/v/release/cepdnaclk/portal.ce.pdn.ac.lk)




# portal.ce.pdn.ac.lk

Internal and Public web service provider of the Department of Computer Engineering

## Team of Developers


To be updated
- [https://portal.ce.pdn.ac.lk/contributors](https://portal.ce.pdn.ac.lk/contributors)

## Useful Commands and Instructions

Expand Down Expand Up @@ -133,6 +137,8 @@ sudo sh ./scripts/deploy-prod.sh

Thanks to all the contributors who have helped with this project!

<a href="https://github.com/cepdnaclk/portal.ce.pdn.ac.lk/graphs/contributors">
<a href="https://portal.ce.pdn.ac.lk/contributors">
https://portal.ce.pdn.ac.lk/contributors
<br/><br/>
<img src="https://contrib.rocks/image?repo=cepdnaclk/portal.ce.pdn.ac.lk" />
</a>
</a>
27 changes: 27 additions & 0 deletions app/DBAL/Types/VersionEnumType.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

namespace App\DBAL\Types;

use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Types\Type;
use App\Domains\AcademicProgram\Course\Models\Course;

class VersionEnumType extends Type
{
const ENUM = 'enum';

public function getSQLDeclaration(array $fieldDeclaration, AbstractPlatform $platform)
{
return "ENUM('" . implode("','", array_keys(Course::getVersions())) . "')";
}

public function convertToPHPValue($value, AbstractPlatform $platform)
{
return $value;
}

public function getName()
{
return self::ENUM;
}
}
27 changes: 22 additions & 5 deletions app/Domains/AcademicProgram/AcademicProgram.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,36 @@ public static function getAcademicPrograms(): array
];
}

public static function getVersions(): array
public static function getVersions($academicProgram = null): array
{
// TODO integrate with Taxonomies
return [
1 => 'Current Curriculum',
2 => 'Curriculum - Effective from E22'
$academicPrograms = [
'undergraduate' => [
1 => 'Current Curriculum',
2 => 'Curriculum - Effective from E22'
],
'postgraduate' => [
3 => 'Current Curriculum - PG',
]
];

if ($academicProgram == null) {
$allAcademicPrograms = [];
foreach ($academicPrograms as $programs) {
foreach ($programs as $key => $value) $allAcademicPrograms[$key] = $value;
}
return $allAcademicPrograms;
} else if (array_key_exists($academicProgram, $academicPrograms)) {
return $academicPrograms[$academicProgram];
} else {
return [];
}
}

public static function getTypes(): array
{
return [
'Found' => 'Foundation',
'Foundation' => 'Foundation',
'Core' => 'Core',
'GE' => 'General Elective',
'TE' => 'Technical Elective'
Expand Down
37 changes: 31 additions & 6 deletions app/Domains/AcademicProgram/Course/Models/Course.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@
namespace App\Domains\AcademicProgram\Course\Models;

use App\Domains\Auth\Models\User;
use App\Domains\AcademicProgram\AcademicProgram;
use App\Domains\AcademicProgram\Course\Models\Traits\Scope\CourseScope;
use App\Domains\AcademicProgram\Semester\Models\Semester;
use Database\Factories\CourseFactory;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Spatie\Activitylog\Traits\LogsActivity;
use App\Domains\AcademicProgram\AcademicProgram;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use App\Domains\AcademicProgram\Semester\Models\Semester;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use App\Domains\AcademicProgram\Course\Models\Traits\Scope\CourseScope;

/**
* Class Course.
Expand All @@ -35,6 +36,8 @@ class Course extends AcademicProgram
'name',
'credits',
'type',
'teaching_methods',
'faq_page',
'content',
'objectives',
'time_allocation',
Expand Down Expand Up @@ -77,8 +80,9 @@ public static function getMarksAllocation(): array
// TODO Get the list from Taxonomies
return [
'practicals' => null,
'tutorials' => null,
'quizzes' => null,
'assignments' => null,
'tutorials' => null,
'projects' => null,
'participation' => null,
'mid_exam' => null,
Expand Down Expand Up @@ -121,14 +125,35 @@ public function semester()

public function version()
{
return $this->getVersions()[$this->version];
$versions = $this->getVersions();
if ($this->version != null && array_key_exists($this->version, $versions)) {
return $versions[$this->version];
} else {
return "Unknown";
}
}

public function modules()
{
return $this->hasMany(CourseModule::class);
}

/**
* Get the prerequisites for the course.
*/
public function prerequisites(): BelongsToMany
{
return $this->belongsToMany(Course::class, 'course_prerequisites', 'course_id', 'prerequisite_id');
}

/**
* Get the courses where this course is a prerequisite.
*/
public function prerequisiteFor(): BelongsToMany
{
return $this->belongsToMany(Course::class, 'course_prerequisites', 'prerequisite_id', 'course_id');
}

protected static function newFactory()
{
return CourseFactory::new();
Expand Down
4 changes: 2 additions & 2 deletions app/Domains/Auth/Services/UserService.php
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ public function destroy(User $user): bool
*/
protected function createUser(array $data = []): User
{
return $this->model::create([
return $this->model::updateOrCreate([
'type' => $data['type'] ?? $this->model::TYPE_USER,
'name' => $data['name'] ?? null,
'email' => $data['email'] ?? null,
Expand All @@ -330,4 +330,4 @@ protected function createUser(array $data = []): User
'active' => $data['active'] ?? true,
]);
}
}
}
13 changes: 13 additions & 0 deletions app/Domains/Event/Models/Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class Event extends Model
protected $fillable = [
'title',
'url',
'event_type',
'published_at',
'description',
'image',
Expand All @@ -46,8 +47,20 @@ class Event extends Model
*/
protected $casts = [
'enabled' => 'boolean',
'event_type' => 'array',
];

public static function eventTypeMap(): array
{
// TODO integrate with Taxonomies
return [
0 => 'Event',
1 => 'Seminar',
2 => 'ACES',

];
}

public function thumbURL()
{
if ($this->image != null) return '/img/events/' . $this->image;
Expand Down
58 changes: 0 additions & 58 deletions app/Domains/Event/Services/AnnouncementService.php

This file was deleted.

Loading
Loading