Merge branch 'distr-check' into 'develop'

Distribution check

See merge request !203
parents 0274000c 9b63d085
......@@ -24,14 +24,14 @@ use Drupal\Core\TypedData\Plugin\DataType\TimeStamp;
use Drupal\Core\Language\LanguageManagerInterface;
define("ERR_DB", -1);
define("NO_CLASS_LIM_DOWN", -2);
define("SMALL_CLS", 1);
define("NON_SMALL_CLS", 2);
class ReportsCreator extends ControllerBase
{
const ERR_DB = -1;
const NO_CLASS_LIM_DOWN = -2;
const SMALL_CLS = 1;
const NON_SMALL_CLS = 2;
protected $entity_query;
protected $entityTypeManager;
protected $logger;
......@@ -673,7 +673,7 @@ class ReportsCreator extends ControllerBase
for ($j = 0; $j < sizeof($schoolNameColumn); $j++) {
// αν έγινε αίτημα για εμφάνιση ολιγομελών και είναι το τρέχον τμήμα ολιγομελές
if (($finalized === "1") ||
($finalized === "0" && $smallClass[$j] === SMALL_CLS
($finalized === "0" && $smallClass[$j] === self::SMALL_CLS
&& $schoolSectionColumn[$j] !== "Β τάξη" && $schoolSectionColumn[$j] !== "Γ τάξη"
&& $schoolSectionColumn[$j] !== "Δ τάξη")) {
array_push($list, (object) array(
......@@ -704,17 +704,17 @@ class ReportsCreator extends ControllerBase
$limitDown = $this->retrieveLimitDown($classId, $regionId);
if ($limitDown === NO_CLASS_LIM_DOWN) {
return NO_CLASS_LIM_DOWN;
} elseif ($limitDown === ERR_DB) {
return ERR_DB;
if ($limitDown === self::NO_CLASS_LIM_DOWN) {
return self::NO_CLASS_LIM_DOWN;
} elseif ($limitDown === self::ERR_DB) {
return self::ERR_DB;
}
$numStudents = (int) $numStud;
if (($numStudents < $limitDown) /*&& ($numStudents > 0)*/) {
return SMALL_CLS;
return self::SMALL_CLS;
} else {
return NON_SMALL_CLS;
return self::NON_SMALL_CLS;
}
}
......@@ -738,18 +738,18 @@ class ReportsCreator extends ControllerBase
$data["$limit->name"]["$limit->category"] = $limit->limit_down;
}
} else {
return NO_CLASS_LIM_DOWN;
return self::NO_CLASS_LIM_DOWN;
}
} catch (\Exception $e) {
$this->logger->warning($e->getMessage());
return ERR_DB;
return self::ERR_DB;
}
}
if (isset($data["$classId"]["$regionId"])) {
return $data["$classId"]["$regionId"];
} else {
return NO_CLASS_LIM_DOWN;
return self::NO_CLASS_LIM_DOWN;
}
}
......
......@@ -593,7 +593,7 @@ export class HelperDataService implements OnInit, OnDestroy {
let options = new RequestOptions({ headers: headers });
return new Promise((resolve, reject) => {
this.http.post(`${AppSettings.API_ENDPOINT}/epal/distribution`, { username: username, userpassword: userpassword }, options)
this.http.post(`${AppSettings.API_ENDPOINT}/epal/distribution`, { }, options)
.map(response => response.json())
.subscribe(data => {
resolve(data);
......@@ -615,7 +615,7 @@ export class HelperDataService implements OnInit, OnDestroy {
let options = new RequestOptions({ headers: headers });
return new Promise((resolve, reject) => {
this.http.post(`${AppSettings.API_ENDPOINT}/epal/distribution-secondperiod`, { username: username, userpassword: userpassword }, options)
this.http.post(`${AppSettings.API_ENDPOINT}/epal/distribution-secondperiod`, { }, options)
.map(response => response.json())
.subscribe(data => {
resolve(data);
......
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