mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-06-04 05:39:28 +00:00
Optimized Reihungstest-chronjob code
. Optimized code by retreiving data directly via model. . Extended SQL query: study courses are now checked for active = true
This commit is contained in:
@@ -40,8 +40,8 @@ class ReihungstestJob extends FHC_Controller
|
||||
|
||||
$this->VILESCI_RT_VERWALTUNGS_URL = site_url(). "/organisation/Reihungstest";
|
||||
|
||||
// Load libraries
|
||||
$this->load->library('ReihungstestLib');
|
||||
// Load models
|
||||
$this->load->model('crm/Reihungstest_model', 'ReihungstestModel');
|
||||
|
||||
// Load helpers
|
||||
$this->load->helper('hlp_sancho_helper');
|
||||
@@ -63,7 +63,7 @@ class ReihungstestJob extends FHC_Controller
|
||||
public function runReihungstestJob()
|
||||
{
|
||||
// Get study plans that have no assigned placement tests yet
|
||||
$result = $this->reihungstestlib->checkMissingReihungstest();
|
||||
$result = $this->ReihungstestModel->checkMissingReihungstest();
|
||||
|
||||
$missing_rt_arr = array();
|
||||
if (hasData($result))
|
||||
@@ -76,7 +76,7 @@ class ReihungstestJob extends FHC_Controller
|
||||
}
|
||||
|
||||
// Get free places
|
||||
$result = $this->reihungstestlib->getFreePlaces();
|
||||
$result = $this->ReihungstestModel->getFreePlaces();
|
||||
|
||||
$free_places_arr = array();
|
||||
if (hasData($result))
|
||||
@@ -108,7 +108,7 @@ class ReihungstestJob extends FHC_Controller
|
||||
* Returns associative array with data as needed in the reihungstest job template.
|
||||
* @param array $missing_rt_arr Array with studienpläne, which have no assigned placement tests.
|
||||
* @param array $free_places_arr Array with info and amount of free placement test places.
|
||||
* @return array
|
||||
* @return array
|
||||
*/
|
||||
private function _getContentData($missing_rt_arr, $free_places_arr)
|
||||
{
|
||||
|
||||
@@ -81,27 +81,4 @@ class ReihungstestLib
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if there are active studyplans which have no public placement tests assigned yet.
|
||||
* Only check studyplans that are
|
||||
* - bachelor,
|
||||
* - active,
|
||||
* - set as online application
|
||||
* - valid for 1st term
|
||||
* @return type
|
||||
*/
|
||||
public function checkMissingReihungstest()
|
||||
{
|
||||
return $this->ci->ReihungstestModel->checkMissingReihungstest();
|
||||
}
|
||||
|
||||
/** Gets amount of free places.
|
||||
* Retrieves faculty and amount of free places for each public placement test date.
|
||||
* @return array
|
||||
*/
|
||||
public function getFreePlaces()
|
||||
{
|
||||
return $this->ci->ReihungstestModel->getFreePlaces();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,6 +41,12 @@ class Reihungstest_model extends DB_Model
|
||||
|
||||
/**
|
||||
* Checks if there are active studyplans which have no public placement tests assigned yet.
|
||||
* Only check assignment to studyplans that are
|
||||
* - Bachelor,
|
||||
* - active,
|
||||
* - set as online application
|
||||
* - valid for 1st terms
|
||||
* @return array Returns object array with studyplans that have no public placement tests assigned yet.
|
||||
*/
|
||||
public function checkMissingReihungstest()
|
||||
{
|
||||
@@ -70,6 +76,8 @@ class Reihungstest_model extends DB_Model
|
||||
public.tbl_studiengang
|
||||
USING (studiengang_kz)
|
||||
WHERE
|
||||
tbl_studiengang.aktiv = \'t\'
|
||||
AND
|
||||
tbl_studiensemester.onlinebewerbung = \'t\'
|
||||
AND
|
||||
tbl_studienplan.onlinebewerbung_studienplan = \'t\'
|
||||
@@ -97,8 +105,10 @@ class Reihungstest_model extends DB_Model
|
||||
return $this->execQuery($query);
|
||||
}
|
||||
|
||||
/** Gets amount of free places.
|
||||
* Retrieves faculty and amount of free places for each public placement test date.
|
||||
/**
|
||||
* Gets amount of free places.
|
||||
* @return array Returns object array with faculty and amount of free places
|
||||
* for each public actual placement test date.
|
||||
*/
|
||||
public function getFreePlaces()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user