Skip to content

Commit

Permalink
Merge branch '3.x-ce'
Browse files Browse the repository at this point in the history
  • Loading branch information
hrshadhin committed Sep 4, 2020
2 parents 72ecc3f + ded3888 commit 2054568
Show file tree
Hide file tree
Showing 15 changed files with 772 additions and 416 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 3.0.1 # 2020-09-02
- Update libs
- Fixed minor bugs

## 3.0.0 # 2020-07-16
- Upgrade support to PHP 7.2 from 7.1
- Upgraded to Laravel 6(LTS) from 5.8
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/Backend/ClassProfileController.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function store(Request $request)

ClassProfile::create($data);

return redirect()->back()->with('success', 'New class profile created.');
return redirect()->route('class_profile.create')->with('success', 'New class profile created.');
}

public function edit($id)
Expand Down
25 changes: 11 additions & 14 deletions app/Http/Controllers/Backend/MarkController.php
Original file line number Diff line number Diff line change
Expand Up @@ -1173,6 +1173,8 @@ private function isAndInCombine($subject_id, $rules){

return $isCombine;
}


private function processCombineSubjectMarks($subjectMarks, $pairSubjectMarks, $subjectRule, $pairSubjectRule){
$pairFail = false;

Expand Down Expand Up @@ -1496,13 +1498,10 @@ public function doPromotion(Request $request){
->where('status', AppHelper::ACTIVE)
->orderBy('order', 'asc')
->get()
->reduce(function ($subjects, $subject){
$subjects[] = [
'subject_id' => $subject->id,
'subject_type' => 1 //core subject
];
return $subjects;
});
->mapWithKeys(function ($sub) {
return [$sub->id => ['subject_type' => "1"]];
})->toArray();

$need_to_assign_subject = false;
if(count($subjects)>0){
$need_to_assign_subject = true;
Expand Down Expand Up @@ -1610,13 +1609,11 @@ public function doPromotion(Request $request){
if (!isset($studentsSubjects[$oldId])) {
continue;
}
$subjectWithType = $studentsSubjects[$oldId]->map(function ($record, $key) {
return [
'subject_id' => $record->subject_id,
'subject_type' => $record->subject_type,
];
});
$student->subjects()->sync($subjectWithType->toArray());

$subjectWithType = $studentsSubjects[$oldId]->mapWithKeys(function ($record) {
return [$record->subject_id => ['subject_type' => $record->subject_type]];
})->toArray();
$student->subjects()->sync($subjectWithType);
}
}
// re-admission done
Expand Down
5 changes: 4 additions & 1 deletion app/Http/Controllers/Backend/SiteController.php
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,9 @@ public function contactUs(Request $request)
['meta_key' => 'contact_latlong'],
[ 'meta_value' => $request->get('latlong')]
);

Cache::forget('site_metas');

return redirect()->route('site.contact_us')->with('success', 'Information saved!');
}

Expand Down Expand Up @@ -517,7 +520,7 @@ public function settings(Request $request)
];
$this->validate($request, [
'name' => 'required|min:5|max:255',
'short_name' => 'required|min:5|max:255',
'short_name' => 'required|min:3|max:255',
'logo' => 'nullable|mimes:jpeg,jpg,png|max:1024|dimensions:min_width=82,min_height=72,max_width=82,max_height=72',
'logo2x' => 'nullable|mimes:jpeg,jpg,png|max:1024|dimensions:min_width=162,min_height=142,max_width=162,max_height=142',
'favicon' => 'nullable|mimes:png|max:512|dimensions:min_width=32,min_height=32,max_width=32,max_height=32',
Expand Down
65 changes: 19 additions & 46 deletions app/Http/Controllers/Backend/StudentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -319,38 +319,24 @@ public function store(Request $request)


//fetch core subject from db
$subjects = Subject::select('id as subject_id','type as subject_type')
$subjects = Subject::select('id')
->where('class_id', $data['class_id'])
->where('type', 1) // 1 =core 2= elective , 3 = selective
->where('status', AppHelper::ACTIVE)
->orderBy('order', 'asc')
->get()
->toArray();
->mapWithKeys(function ($sub) {
return [$sub->id => ['subject_type' => "1"]];
})->toArray();

// $subjects = array_map(function ($subject){
// return [
// 'subject_id' => $subject,
// 'subject_type' => 1
// ];
// }, $data['core_subjects']);


if(isset($data['selective_subjects'])) {
$selectiveSubjects = array_map(function ($subject) {
return [
'subject_id' => $subject,
'subject_type' => 3
];
}, $data['selective_subjects']);

$subjects = array_merge($subjects, $selectiveSubjects);
if (isset($data['selective_subjects'])) {
foreach ($data['selective_subjects'] as $sub) {
$subjects[$sub] = ['subject_type' => "3"];
}
}

if(isset($data['fourth_subject'])){
$subjects[] = [
'subject_id' => $data['fourth_subject'],
'subject_type' => 2
];
if (isset($data['fourth_subject'])) {
$subjects[$data['fourth_subject']] = ['subject_type' => "2"];
}

//card_no manual validation
Expand Down Expand Up @@ -429,7 +415,7 @@ public function store(Request $request)
];

$registration = Registration::create($registrationData);
$registration->subjects()->sync($subjects);
$registration->subjects()->sync($subjects);

// now commit the database
DB::commit();
Expand Down Expand Up @@ -749,37 +735,24 @@ public function update(Request $request, $id)
$subjects = [];
$oldSubjects = [];
if($allowSubjectUpdate) {
$subjects = Subject::select('id as subject_id', 'type as subject_type')
$subjects = Subject::select('id', 'type as sub_type')
->where('class_id', $regiInfo->class_id)
->where('type', 1)// 1 =core 2= elective , 3 = selective
->where('status', AppHelper::ACTIVE)
->orderBy('order', 'asc')
->get()
->toArray();

// $subjects = array_map(function ($subject){
// return [
// 'subject_id' => $subject,
// 'subject_type' => 1
// ];
// }, $data['core_subjects']);
->mapWithKeys(function ($sub) {
return [$sub->id => ['subject_type' => "1"]];
})->toArray();

if (isset($data['selective_subjects'])) {
$selectiveSubjects = array_map(function ($subject) {
return [
'subject_id' => $subject,
'subject_type' => 3
];
}, $data['selective_subjects']);

$subjects = array_merge($subjects, $selectiveSubjects);
foreach ($data['selective_subjects'] as $sub) {
$subjects[$sub] = ['subject_type' => "3"];
}
}

if (isset($data['fourth_subject'])) {
$subjects[] = [
'subject_id' => $data['fourth_subject'],
'subject_type' => 2
];
$subjects[$data['fourth_subject']] = ['subject_type' => "2"];
}

//fetch old subjects for this student
Expand Down
2 changes: 1 addition & 1 deletion app/Http/ViewComposers/BackendMasterComposer.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function compose(View $view)
$view->with('maintainer_url', 'http://cloudschoolbd.com');
$view->with('majorVersion', '3');
$view->with('minorVersion', '0');
$view->with('patchVersion', '0');
$view->with('patchVersion', '1');
$view->with('suffixVersion', 'ce');
$view->with('appSettings', $appSettings);
$view->with('languages', AppHelper::LANGUEAGES);
Expand Down
2 changes: 1 addition & 1 deletion app/Http/ViewComposers/ReportMasterComposer.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function compose(View $view)
$view->with('maintainer_url', 'http://cloudschoolbd.com');
$view->with('majorVersion', '3');
$view->with('minorVersion', '0');
$view->with('patchVersion', '0');
$view->with('patchVersion', '1');
$view->with('suffixVersion', 'ce');
$view->with('instituteName', $instituteName);
$view->with('instituteAddress', $instituteAddress);
Expand Down
Loading

0 comments on commit 2054568

Please sign in to comment.