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

operation_module_code_clean #3751

Merged
merged 29 commits into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
fe16764
operation_module_code_clean
SagarZeddlabz Dec 11, 2024
7b9b2ee
updated
sagar1862000 Dec 12, 2024
ca3f5fe
issues resolved
sagar1862000 Dec 12, 2024
7a2bb34
migration issue
sagar1862000 Dec 12, 2024
b98ade0
m
sagar1862000 Dec 12, 2024
d48a2de
M
sagar1862000 Dec 12, 2024
d5a0f5a
M
sagar1862000 Dec 12, 2024
a8405a9
indentation error solved
sagar1862000 Dec 12, 2024
99da9e1
indentation error solved
sagar1862000 Dec 12, 2024
1813038
imports related error solved
sagar1862000 Dec 12, 2024
933e3d0
imports related error solved
sagar1862000 Dec 12, 2024
fd1045d
imports related error solved
sagar1862000 Dec 12, 2024
e39eb25
homeController related error solved
sagar1862000 Dec 12, 2024
d983b40
office location cleanups in user modules
rathorevaibhav Dec 24, 2024
fd9e7d4
more cleanups
rathorevaibhav Dec 27, 2024
d8ad8aa
reverted unnecssary change
rathorevaibhav Dec 27, 2024
220849a
updated composer
rathorevaibhav Dec 27, 2024
107fa24
updated composer
rathorevaibhav Dec 27, 2024
6ee2d98
added packge in require-dev
rathorevaibhav Dec 27, 2024
e02b973
phpcsfixer addition
rathorevaibhav Jan 9, 2025
b3c16cf
ci updates
rathorevaibhav Jan 9, 2025
1280e6a
fully_qualified_strict_types set to false
rathorevaibhav Jan 9, 2025
ea771b4
ci fixes
rathorevaibhav Jan 9, 2025
2b31556
phpcs fixer
rathorevaibhav Jan 9, 2025
a22c28e
other ci fixes
rathorevaibhav Jan 9, 2025
44a06bb
psr12
rathorevaibhav Jan 9, 2025
eb47b95
all fixes
rathorevaibhav Jan 9, 2025
a5571d4
migration fixes
rathorevaibhav Jan 9, 2025
db46c19
coderabbit fix
rathorevaibhav Jan 9, 2025
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
11 changes: 9 additions & 2 deletions .github/workflows/coding-standards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,26 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Setup PHP v7.4
uses: shivammathur/setup-php@v2
with:
php-version: "7.4"

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

- name: Setup env file
run: cp ./.env.example .env

- name: Configure application encryption key
run: php artisan key:generate

- name: Install NPM Dependencies
run: npm install
- name: clear cache

- name: Clear cache
run: php artisan cache:clear

- name: ColoredCowLaravelCI
run: "php artisan check:ci --with-tty"
run: php artisan check:ci --with-tty
6 changes: 5 additions & 1 deletion .php-cs-fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
'elseif' => true,
'encoding' => true,
'full_opening_tag' => true,
'fully_qualified_strict_types' => true,
'fully_qualified_strict_types' => false,
'function_declaration' => true,
'function_typehint_space' => true,
'heredoc_to_nowdoc' => true,
Expand Down Expand Up @@ -82,6 +82,10 @@
'normalize_index_brace' => true,
'not_operator_with_successor_space' => true,
'object_operator_without_whitespace' => true,
'phpdoc_no_alias_tag' => true,
'phpdoc_align' => [
'tags' => ['param', 'return', 'throws', 'type'],
],
'phpdoc_indent' => true,
'phpdoc_no_access' => true,
'phpdoc_no_package' => true,
Expand Down
6 changes: 0 additions & 6 deletions Modules/CodeTrek/Entities/CodeTrekApplicant.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Modules\CodeTrek\Database\factories\CodeTrekApplicantFactory;
use Modules\Operations\Entities\OfficeLocation;
use Modules\User\Entities\User;

class CodeTrekApplicant extends Model
Expand All @@ -25,11 +24,6 @@ public static function factory()
return new CodeTrekApplicantFactory();
}

public function center()
{
return $this->belongsTo(OfficeLocation::class, 'center_id');
}

public function getDaysInCodetrekAttribute()
{
$internshipStartDate = Carbon::parse($this->internship_start_date);
Expand Down
7 changes: 1 addition & 6 deletions Modules/CodeTrek/Http/Controllers/CodeTrekController.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
use Modules\CodeTrek\Entities\CodeTrekApplicant;
use Modules\CodeTrek\Http\Requests\CodeTrekRequest;
use Modules\CodeTrek\Services\CodeTrekService;
use Modules\Operations\Entities\OfficeLocation;
use Modules\User\Entities\User;

class CodeTrekController extends Controller
Expand All @@ -28,7 +27,6 @@ public function index(Request $request)
{
// $this->authorize('view', $applicant); There are some issues in the production, which is why these lines are commented out.

$centres = OfficeLocation::all();
$mentors = User::all();
$applicantData = $this->service->getCodeTrekApplicants($request->all());
$applicants = $applicantData['applicants'];
Expand All @@ -41,7 +39,6 @@ public function index(Request $request)

return view('codetrek::index', [
'applicants' => $applicants,
'centres' => $centres,
'mentors' => $mentors,
'reportApplicationCounts' => $reportApplicationCounts,
'statusCounts' => $statusCounts,
Expand Down Expand Up @@ -78,12 +75,10 @@ public function edit(CodeTrekApplicant $applicant)
{
// $this->authorize('update', $applicant); There are some issues in the production, which is why these lines are commented out.

$centres = OfficeLocation::all();

$mentors = User::all();
$this->service->edit($applicant);

return view('codetrek::edit', ['applicant' => $applicant, 'centres' => $centres, 'mentors' => $mentors]);
return view('codetrek::edit', ['applicant' => $applicant, 'mentors' => $mentors]);
}
public function evaluate(CodeTrekApplicant $applicant)
{
Expand Down
10 changes: 5 additions & 5 deletions Modules/CodeTrek/Policies/CodetrekApplicantPolicy.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class CodeTrekApplicantPolicy
/**
* Determine whether the user can view any models.
*
* @param \Modules\User\Entities\User $user
* @param \Modules\User\Entities\User $user
*
* @return mixed
*/
Expand All @@ -24,7 +24,7 @@ public function viewAny(User $user)
/**
* Determine whether the user can view the model.
*
* @param \Modules\User\Entities\User $user
* @param \Modules\User\Entities\User $user
*
* @return mixed
*/
Expand All @@ -36,7 +36,7 @@ public function view(User $user)
/**
* Determine whether the user can create models.
*
* @param \Modules\User\Entities\User $user
* @param \Modules\User\Entities\User $user
*
* @return mixed
*/
Expand All @@ -48,7 +48,7 @@ public function create(User $user)
/**
* Determine whether the user can update the model.
*
* @param \Modules\User\Entities\User $user
* @param \Modules\User\Entities\User $user
*
* @return mixed
*/
Expand All @@ -60,7 +60,7 @@ public function update(User $user)
/**
* Determine whether the user can delete the model.
*
* @param \Modules\User\Entities\User $user
* @param \Modules\User\Entities\User $user
*
* @return mixed
*/
Expand Down
13 changes: 2 additions & 11 deletions Modules/CodeTrek/Resources/views/edit.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
@section('content')

<div class="container" id="update_details">
<div class="card-body">
<div class="card-body">
<form action="{{route('codetrek.update', $applicant)}}" method="POST" id='updateForm' enctype="multipart/form-data">
@csrf
<input type="hidden" name="codetrek" value="applicant->id">
<div class="card-body">
<h4 class="mb-3 font-weight-bold">Edit Applicant information</h4>
<h4 class="mb-3 font-weight-bold">Edit Applicant Information</h4>
@if ($errors->any())
<div class="alert alert-danger">
<ul>
Expand Down Expand Up @@ -71,15 +71,6 @@
@endfor
</select>
</div>
<div class="form-group offset-md-1 col-md-5">
<label for="centre" class="field-required">Centre Name</label>
<select name="centre" id="centreId" class="form-control" required>
<option value="">Select Centre Name</option>
@foreach($centres as $centre)
<option value="{{ $centre->id }}" {{ $applicant->centre_id == $centre->id ? 'selected' : '' }}>{{ $centre->centre_name }}</option>
@endforeach
</select>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-5">
Expand Down
20 changes: 10 additions & 10 deletions Modules/CodeTrek/Resources/views/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<div>
<form action="{{ route('codetrek.index') }}" id="centreFilterForm">
<div class="form-group ml-25 w-180">
@can('codetrek_applicant.create')
@can('codetrek_applicant.create')
<select class="form-control bg-light" name="centre" id="centre" onchange="document.getElementById('centreFilterForm').submit();">
<option value="" {{ !request()->has('centre') || empty(request()->get('centre')) ? 'selected' : '' }}>
{!! __('All Centres') !!}
Expand Down Expand Up @@ -83,7 +83,7 @@
<span class="d-inline-block h-18 w-20">{!! file_get_contents(public_path('icons/clipboard-check.svg')) !!}</span>
Active({{ $statusCounts['active'] }})
</a>
</li>
</li>
<li class="nav-item mr-3">
@php
$inactiveParams = array_merge(request()->except(['status']), ['status' => 'inactive']);
Expand All @@ -96,7 +96,7 @@
<span class="d-inline-block h-18 w-20">{!! file_get_contents(public_path('icons/x-circle.svg')) !!}</span>
Inactive({{ $statusCounts['inactive'] }})
</a>
</li>
</li>
<li class="nav-item mr-3">
@php
$completedParams = ['name' => $name, 'centre' => $centre, 'status' => 'completed'];
Expand All @@ -109,7 +109,7 @@
<span class="d-inline-block h-18 w-20">{!! file_get_contents(public_path('icons/person-check.svg')) !!}</span>
Completed({{ $statusCounts['completed'] }})
</a>
</li>
</li>
</div>
@elseif (request()->tab == 'reports')
<li class="nav-item mr-3">
Expand Down Expand Up @@ -165,7 +165,7 @@
<tbody>
@forelse ($applicants as $applicant)
<tr>
<td>
<td>
<div class="d-flex align-items-center">
<div class="d-flex align-items-center">
<h4>{{ $applicant->first_name }} {{ $applicant->last_name }}</h4>
Expand Down Expand Up @@ -207,15 +207,15 @@ class="btn-sm btn-primary mr-1 text-decoration-none"
<span class="{{ config('codetrek.rounds.' . $applicant->latest_round_name . '.class') }} badge-pill mr-1 mb-1 fz-16">
{{ config('codetrek.rounds.' . $applicant->latest_round_name . '.label') }}
</span>
</div>
</div>
</td>
<td>
<div class="d-flex align-items-center">
<div class="d-flex align-items-center">
@if ($applicant->mentor)
<div class="col">
<div class="d-flex align-items-center">
<div class="d-flex align-items-center">
<img src="{{ $applicant->mentor->avatar }}" class="w-35 h-30 rounded-circle ">
<h4 class="ml-2 mb-0">{{ $applicant->mentor->name }}</h4>
<h4 class="ml-2 mb-0">{{ $applicant->mentor->name }}</h4>
</div>
</div>
@else
Expand Down Expand Up @@ -249,7 +249,7 @@ class="btn-sm btn-primary mr-1 text-decoration-none"
</div>
<canvas class="w-full" id="CodeTrekApplicationReport"></canvas>
</div>
</div>
</div>
@endif
</div>
@endsection
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,6 @@
@endfor
</select>
</div>
<div class="form-group offset-md-1 col-md-5">
<label for="centre" class="field-required">Centre Name</label>
<select name="centre" id="centreId" class="form-control" required>
<option value="">Select Centre Name</option>
@foreach($centres as $centre)
<option value="{{ $centre->id }}">{{ $centre->centre_name }}</option>
@endforeach
</select>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-5">
Expand Down
1 change: 0 additions & 1 deletion Modules/CodeTrek/Services/CodeTrekService.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ public function store($data)
$applicant->start_date = $data['start_date'];
$applicant->graduation_year = $data['graduation_year'] ?? null;
$applicant->university = $data['university_name'] ?? null;
$applicant->centre_id = $data['centre'];
$applicant->mentor_id = $data['mentorId'];
$applicant->domain_name = $data['domain'];
$applicant->latest_round_name = config('codetrek.rounds.introductory-call.slug');
Expand Down
9 changes: 0 additions & 9 deletions Modules/Expense/Resources/views/create.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,6 @@
</select>

</div>
<div class="form-group offset-md-1 col-md-5">
<label for="location" class="field-required">Location</label>
<select class="form-control" name="location">
<option value="">Select Location</option>
@foreach (config('constants.office_locations') as $office => $location)
<option value="{{ $office }}">{{ $location }}</option>
@endforeach
</select>
</div>
</div>
<hr>
<div class="parent">
Expand Down
11 changes: 0 additions & 11 deletions Modules/Expense/Resources/views/edit.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,6 @@
@endforeach
</select>
</div>
<div class="form-group offset-md-1 col-md-5">
<label for="location" class="field-required">Location</label>
<select class="form-control" value="{{ $expense->location }}" name="location">
<option value="disabled">Select Location</option>
@foreach (config('constants.office_locations') as $office => $location)
<option
value="{{ $office }}"{{ $expense->location == $office ? 'selected' : '' }}>
{{ $location }}</option>
@endforeach
</select>
</div>
</div>
<hr>
@foreach ($expenseFile as $document)
Expand Down
2 changes: 1 addition & 1 deletion Modules/HR/Entities/Applicant.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class Applicant extends Model
/**
* Custom create method that creates an applicant and fires specific events.
*
* @param array $attr fillables to be stored
* @param array $attr fillables to be stored
*/
public static function _create($attr)
{
Expand Down
2 changes: 1 addition & 1 deletion Modules/HR/Entities/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public function pendingApprovalFrom()
/**
* Custom create method that creates an application and fires necessary events.
*
* @param array $attr fillables to be stored
* @param array $attr fillables to be stored
*/
public static function _create($attr)
{
Expand Down
4 changes: 2 additions & 2 deletions Modules/HR/Entities/Job.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ public function trialRounds()
/**
* Custom update method that updates a job and fires specific events.
*
* @param array $attr fillables to be updated
* @param array $attr fillables to be updated
*
* @return bool|mixed true if update is successful, error object if update fails
* @return bool|mixed true if update is successful, error object if update fails
*/
public function _update($attr)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ public function index()
$attr['universities'] = University::all();
$attr['tags'] = Tag::orderBy('name')->get();
$attr['rounds'] = $hrRoundsCounts;
$attr['roundFilters'] = round::orderBy('name')->get();
$attr['roundFilters'] = Round::orderBy('name')->get();
$attr['assignees'] = User::whereHas('roles', function ($query) {
$query->whereIn('name', ['super-admin', 'admin', 'hr-manager']);
})->orderby('name', 'asc')->get();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function index()

public function searchBydate(Request $req)
{
$req->report_start_date = $req->report_start_date ?? carbon::now()->startOfMonth() == $req->report_end_date = $req->report_end_date ?? Carbon::today();
$req->report_start_date = $req->report_start_date ?? Carbon::now()->startOfMonth() == $req->report_end_date = $req->report_end_date ?? Carbon::today();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix the logical error and improve readability in date assignment.

The current line has multiple issues:

  1. The comparison operator == is incorrectly used where an assignment was intended
  2. The single-line multiple assignment reduces readability
  3. The logic for default dates could be clearer

Replace with:

-        $req->report_start_date = $req->report_start_date ?? Carbon::now()->startOfMonth() == $req->report_end_date = $req->report_end_date ?? Carbon::today();
+        $req->report_start_date = $req->report_start_date ?? Carbon::now()->startOfMonth();
+        $req->report_end_date = $req->report_end_date ?? Carbon::today();
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
$req->report_start_date = $req->report_start_date ?? Carbon::now()->startOfMonth() == $req->report_end_date = $req->report_end_date ?? Carbon::today();
$req->report_start_date = $req->report_start_date ?? Carbon::now()->startOfMonth();
$req->report_end_date = $req->report_end_date ?? Carbon::today();


$todayCount = Applicant::whereDate('created_at', '=', Carbon::today())
->count();
Expand Down
2 changes: 1 addition & 1 deletion Modules/HR/Jobs/SendHiringMailJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@ public function __construct($jobHiring)
*/
public function handle()
{
Mail::queue(new sendHiringMail($this->jobHiring));
Mail::queue(new SendHiringMail($this->jobHiring));
}
}
2 changes: 1 addition & 1 deletion Modules/HR/Listeners/AppointmentSlotMailSent.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function __construct()
/**
* Handle the event.
*
* @param object $event
* @param object $event
*/
public function handle($event)
{
Expand Down
2 changes: 1 addition & 1 deletion Modules/HR/Listeners/FollowUpListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function __construct()
/**
* Handle the event.
*
* @param object $event
* @param object $event
*
* @return void
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function __construct()
/**
* Handle the event.
*
* @param ApplicationCreated $event
* @param ApplicationCreated $event
*
* @return void
*/
Expand Down
Loading
Loading