Merge branch 'edge_v4' into 'develop_v4'

Handled some more subscriptions

See merge request !249
parents 1e3793d5 cfb7efb7
...@@ -611,8 +611,10 @@ class DirectorView extends ControllerBase ...@@ -611,8 +611,10 @@ class DirectorView extends ControllerBase
$SchoolCat = reset($SchoolCats); $SchoolCat = reset($SchoolCats);
if ($SchoolCat) { if ($SchoolCat) {
$categ = $SchoolCat->metathesis_region->value; $categ = $SchoolCat->metathesis_region->value;
$operation_shift = $school -> operation_shift -> value;
} else { } else {
$categ = '-'; $categ = '-';
$operation_shift ='-';
} }
$CourseA = $this->entityTypeManager->getStorage('epal_student')->loadByProperties(array('id' => $schoolid)); $CourseA = $this->entityTypeManager->getStorage('epal_student')->loadByProperties(array('id' => $schoolid));
...@@ -668,6 +670,30 @@ class DirectorView extends ControllerBase ...@@ -668,6 +670,30 @@ class DirectorView extends ControllerBase
} }
} }
if ($operation_shift == 'ΕΣΠΕΡΙΝΟ')
{
$limit = $this->getLimit(4, $categ);
$sCon = $this->connection->select('eepal_specialties_in_epal_field_data', 'eSchool');
$sCon->leftJoin('epal_student_class', 'eStudent',
'eStudent.epal_id = ' . $schoolid . ' ' .
'AND eStudent.specialization_id = eSchool.specialty_id ' .
'AND eStudent.currentclass = 4');
$sCon->fields('eSchool', array('specialty_id'))
->fields('eStudent', array('specialization_id'))
->groupBy('specialization_id')
->groupBy('specialty_id')
->condition('eSchool.epal_id', $schoolid, '=');
$sCon->addExpression('count(eStudent.id)', 'eStudent_count');
$results = $sCon->execute()->fetchAll(\PDO::FETCH_OBJ);
foreach ($results as $result) {
if ($result->eStudent_count < $limit) {
return false;
}
}
}
return true; return true;
} }
......
...@@ -104,10 +104,6 @@ import { ReportsSchema, TableColumn } from "./reports-schema"; ...@@ -104,10 +104,6 @@ import { ReportsSchema, TableColumn } from "./reports-schema";
this.loginInfoSub.unsubscribe(); this.loginInfoSub.unsubscribe();
if (this.generalReportSub) if (this.generalReportSub)
this.generalReportSub.unsubscribe(); this.generalReportSub.unsubscribe();
if (this.loginInfo$)
this.loginInfo$.unsubscribe();
if (this.generalReport$)
this.generalReport$.unsubscribe();
} }
createReport() { createReport() {
......
...@@ -60,6 +60,7 @@ export default class SchoolHome implements OnInit, OnDestroy { ...@@ -60,6 +60,7 @@ export default class SchoolHome implements OnInit, OnDestroy {
private xcsrftoken: any; private xcsrftoken: any;
private loginInfo$: BehaviorSubject<ILoginInfoRecords>; private loginInfo$: BehaviorSubject<ILoginInfoRecords>;
private loginInfoSub: Subscription; private loginInfoSub: Subscription;
private queryParamSub: Subscription;
private apiEndPoint = API_ENDPOINT; private apiEndPoint = API_ENDPOINT;
private apiEndPointParams = API_ENDPOINT_PARAMS; private apiEndPointParams = API_ENDPOINT_PARAMS;
...@@ -83,8 +84,8 @@ export default class SchoolHome implements OnInit, OnDestroy { ...@@ -83,8 +84,8 @@ export default class SchoolHome implements OnInit, OnDestroy {
ngOnDestroy() { ngOnDestroy() {
if (this.loginInfoSub) if (this.loginInfoSub)
this.loginInfoSub.unsubscribe(); this.loginInfoSub.unsubscribe();
this.loginInfo$.unsubscribe(); if (this.queryParamSub)
this.errorCode$.unsubscribe(); this.queryParamSub.unsubscribe();
}; };
ngOnInit() { ngOnInit() {
...@@ -112,7 +113,7 @@ export default class SchoolHome implements OnInit, OnDestroy { ...@@ -112,7 +113,7 @@ export default class SchoolHome implements OnInit, OnDestroy {
}); });
// subscribe to router event // subscribe to router event
this.activatedRoute.queryParams.subscribe((params: Params) => { this.queryParamSub = this.activatedRoute.queryParams.subscribe((params: Params) => {
if (params) { if (params) {
this.authToken = params["auth_token"]; this.authToken = params["auth_token"];
this.authRole = params["auth_role"]; this.authRole = params["auth_role"];
......
...@@ -188,7 +188,7 @@ import { IAppState } from "../../store/store"; ...@@ -188,7 +188,7 @@ import { IAppState } from "../../store/store";
} }
ngOnDestroy() { ngOnDestroy() {
if (this.loginInfo$) this.loginInfo$.unsubscribe(); if (this.loginInfoSub) this.loginInfoSub.unsubscribe();
} }
ngOnInit() { ngOnInit() {
......
...@@ -268,8 +268,6 @@ import { IAppState } from "../../store/store"; ...@@ -268,8 +268,6 @@ import { IAppState } from "../../store/store";
this.SubmitedUsersSub.unsubscribe(); this.SubmitedUsersSub.unsubscribe();
if (this.SubmitedDetailsSub) if (this.SubmitedDetailsSub)
this.SubmitedDetailsSub.unsubscribe(); this.SubmitedDetailsSub.unsubscribe();
this.SubmitedDetails$.unsubscribe();
this.SubmitedApplic$.unsubscribe();
} }
ngOnInit() { ngOnInit() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment