Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
e-epal
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Χάρης Παπαδόπουλος
e-epal
Commits
698e4e7b
Commit
698e4e7b
authored
Jun 15, 2017
by
Νίκος Κατσαούνος
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated Distribution Controller with second Period distribution
parent
ed27fc4c
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
98 additions
and
32 deletions
+98
-32
drupal/modules/epal/src/Controller/Distribution.php
drupal/modules/epal/src/Controller/Distribution.php
+66
-25
drupal/modules/epal/src/Controller/ReportsCreator.php
drupal/modules/epal/src/Controller/ReportsCreator.php
+21
-5
source/components/minister/minister-informstudents.ts
source/components/minister/minister-informstudents.ts
+4
-0
source/components/minister/minister-reports.ts
source/components/minister/minister-reports.ts
+3
-1
source/components/minister/minister-view.ts
source/components/minister/minister-view.ts
+4
-1
No files found.
drupal/modules/epal/src/Controller/Distribution.php
View file @
698e4e7b
...
...
@@ -172,7 +172,8 @@ class Distribution extends ControllerBase {
//print_r("<br>FETCH: " . $j);
$sCon
=
$this
->
connection
->
select
(
'epal_student'
,
'eStudent'
)
->
fields
(
'eStudent'
,
array
(
'id'
,
'name'
,
'currentclass'
,
'currentepal'
,
'points'
))
//->fields('eStudent', array('id', 'name', 'currentclass', 'currentepal', 'points'))
->
fields
(
'eStudent'
,
array
(
'id'
,
'currentclass'
,
'currentepal'
,
'second_period'
))
->
condition
(
'eStudent.id'
,
1
+
$sizeOfBlock
*
(
$j
-
1
),
'>='
)
->
condition
(
'eStudent.id'
,
$j
*
$sizeOfBlock
,
'<='
);
$epalStudents
=
$sCon
->
execute
()
->
fetchAll
(
\
PDO
::
FETCH_OBJ
);
...
...
@@ -190,7 +191,8 @@ class Distribution extends ControllerBase {
if
(
sizeof
(
$this
->
pendingStudents
)
!=
0
)
{
$sCon
=
$this
->
connection
->
select
(
'epal_student'
,
'eStudent'
)
->
fields
(
'eStudent'
,
array
(
'id'
,
'name'
,
'currentclass'
,
'currentepal'
,
'points'
))
//->fields('eStudent', array('id', 'name', 'currentclass', 'currentepal', 'points'))
->
fields
(
'eStudent'
,
array
(
'id'
,
'currentclass'
,
'currentepal'
,
'second_period'
))
->
condition
(
'eStudent.id'
,
$this
->
pendingStudents
,
'IN'
);
$epalStudents
=
$sCon
->
execute
()
->
fetchAll
(
\
PDO
::
FETCH_OBJ
);
...
...
@@ -361,6 +363,7 @@ class Distribution extends ControllerBase {
//'points' => $epalStudent->points,
'distribution_id'
=>
$choice_id
,
'finalized'
=>
1
,
'second_period'
=>
$epalStudent
->
second_period
,
'status'
=>
1
,
'created'
=>
$timestamp
,
'changed'
=>
$timestamp
,)
...
...
@@ -580,25 +583,12 @@ public function checkCapacityAndArrange($epalId, $classId, $secCourId, $limitup,
}
}
//endif new limit
else
{
//$newlimit > 0
//NEW CODE LINES
if
(
$this
->
choice_id
!==
1
)
$this
->
removeFromPendingStudents
(
$student
->
student_id
);
}
//END NEW CODE LINES
}
//endif currentepal
}
//end foreach
//NEW CODE LINES
/*
else {
foreach($students as $student)
if ($student->currentepal !== $student->epal_id)
if ($this->choice_id !== 1)
$this->removeFromPendingStudents($student->student_id);
}
*/
//END NEW CODE LINES
return
SUCCESS
;
...
...
@@ -702,8 +692,6 @@ public function checkCapacityAndArrange($epalId, $classId, $secCourId, $limitup,
}
}
//end if ΕΣΠΕΡΙΝΟ
}
//end for each school/department
return
SUCCESS
;
...
...
@@ -854,30 +842,48 @@ public function checkCapacityAndArrange($epalId, $classId, $secCourId, $limitup,
],
Response
::
HTTP_FORBIDDEN
);
}
try
{
if
(
$this
->
initializeResultsInSecondPeriod
()
===
ERROR_DB
)
return
$this
->
respondWithStatus
([
"message"
=>
t
(
"Unexpected Error in initializeResultsInSecondPeriod function"
)
],
Response
::
HTTP_INTERNAL_SERVER_ERROR
);
$sCon
=
$this
->
connection
->
select
(
'epal_student'
,
'eStudent'
)
->
fields
(
'eStudent'
,
array
(
'id'
,
'currentclass'
,
'currentepal'
))
->
fields
(
'eStudent'
,
array
(
'id'
,
'currentclass'
,
'currentepal'
,
'second_period'
))
->
condition
(
'eStudent.second_period'
,
1
,
'='
);
$epalStudents
=
$sCon
->
execute
()
->
fetchAll
(
\
PDO
::
FETCH_OBJ
);
//
$this->globalCounterId = 10000;
//
τοποθέτηση όλων των μαθητών Β' περιόδου στην πρώτη τους προτίμηση'
$this
->
globalCounterId
=
$this
->
retrieveLastStudentId
()
+
1
;
if
(
$this
->
locateStudent
(
1
,
$epalStudents
)
===
ERROR_DB
)
return
$this
->
respondWithStatus
([
"message"
=>
t
(
"Unexpected Error in locateStudent function"
)
"message"
=>
t
(
"Unexpected Error in locateStudent function after calling locateSecondPeriodStudents method"
),
"numOfDeletions"
=>
$num
],
Response
::
HTTP_INTERNAL_SERVER_ERROR
);
if
(
$this
->
findSmallClasses
()
===
ERROR_DB
)
//επαναϋπολογισμός όλων των ολιγομελών τμημάτων (Προσοχή: αφορά ΟΛΟΥΣ τους μαθητές - κανονικής και Β΄ περιόδου)
//αρχικοποίηση flag finalize σε 1 για όλους
if
(
$this
->
setFinalize
()
===
ERROR_DB
)
return
$this
->
respondWithStatus
([
"message"
=>
t
(
"Unexpected Error in
findSmallClasses
function AFTER locateSecondPeriodStudents!"
)
"message"
=>
t
(
"Unexpected Error in
setFinalize
function AFTER locateSecondPeriodStudents!"
)
],
Response
::
HTTP_INTERNAL_SERVER_ERROR
);
//αν αποτύχει, δεν γίνεται rollback. --> Λύση: διαγρα΄φή των όποιων αποτελεσμάτων ;;
//εύρεση ολιγομελών και καταχώρηση μαθητών σε αυτά με κατάλληλη ένδειξη (finalize=0)
if
(
$this
->
findSmallClasses
()
===
ERROR_DB
)
{
//αν αποτύχει, δεν γίνεται rollback. --> Λύση: διαγρα΄φή των όποιων αποτελεσμάτων
if
(
$this
->
initializeResultsInSecondPeriod
()
===
ERROR_DB
)
return
$this
->
respondWithStatus
([
"message"
=>
t
(
"Unexpected Error in initializeResults function AFTER findSmallClasses call Function"
)
],
Response
::
HTTP_INTERNAL_SERVER_ERROR
);
return
$this
->
respondWithStatus
([
"message"
=>
t
(
"Unexpected Error in findSmallClasses function AFTER locateSecondPeriodStudents!"
)
],
Response
::
HTTP_INTERNAL_SERVER_ERROR
);
}
}
...
...
@@ -902,10 +908,45 @@ public function checkCapacityAndArrange($epalId, $classId, $secCourId, $limitup,
}
}
private
function
setFinalize
()
{
try
{
$query
=
$this
->
connection
->
update
(
'epal_student_class'
);
$query
->
fields
([
'finalized'
=>
1
,
]);
$query
->
execute
();
}
catch
(
\
Exception
$e
)
{
$this
->
logger
->
warning
(
$e
->
getMessage
());
return
ERROR_DB
;
}
return
SUCCESS
;
}
private
function
initializeResultsInSecondPeriod
()
{
//initialize/empty epal_student_class if there are already data in it!
try
{
//$this->connection->delete('epal_student_class')->execute();
$con
=
$this
->
connection
->
prepare
(
"delete from epal_student_class where second_period = 1 "
);
$con
->
execute
();
//$num = $con->rowCount();
}
catch
(
\
Exception
$e
)
{
$this
->
logger
->
warning
(
$e
->
getMessage
());
return
ERROR_DB
;
}
return
SUCCESS
;
}
private
function
retrieveLastStudentId
()
{
$sCon
=
$this
->
connection
->
select
(
'epal_student'
,
'eStudent'
)
...
...
drupal/modules/epal/src/Controller/ReportsCreator.php
View file @
698e4e7b
...
...
@@ -95,19 +95,35 @@ class ReportsCreator extends ControllerBase {
],
Response
::
HTTP_FORBIDDEN
);
}
//υπολογισμός αριθμού δηλώσεων
$list
=
array
();
//υπολογισμός αριθμού αιτήσεων
$sCon
=
$this
->
connection
->
select
(
'epal_student'
,
'eStudent'
)
->
fields
(
'eStudent'
,
array
(
'id'
));
$numApplications
=
$sCon
->
countQuery
()
->
execute
()
->
fetchField
();
array_push
(
$list
,(
object
)
array
(
'name'
=>
"Αριθμός Αιτήσεων (συνολικά)"
,
'numStudents'
=>
$numApplications
));
//υπολογισμός αριθμού αιτήσεων ανά τάξη
for
(
$i
=
1
;
$i
<=
4
;
$i
++
)
{
$sCon
=
$this
->
connection
->
select
(
'epal_student'
,
'eStudent'
)
->
fields
(
'eStudent'
,
array
(
'id'
))
->
condition
(
'eStudent.currentclass'
,
strval
(
$i
)
,
'='
);
$numApplications
=
$sCon
->
countQuery
()
->
execute
()
->
fetchField
();
array_push
(
$list
,(
object
)
array
(
'name'
=>
"Αριθμός Αιτήσεων για "
.
$i
.
"η Τάξη"
,
'numStudents'
=>
$numApplications
));
}
//υπολογισμός αριθμού αιτήσεων για δεύτερη περίοδο
$sCon
=
$this
->
connection
->
select
(
'epal_student'
,
'eStudent'
)
->
fields
(
'eStudent'
,
array
(
'id'
))
->
condition
(
'eStudent.second_period'
,
1
,
'='
);
$numApplications
=
$sCon
->
countQuery
()
->
execute
()
->
fetchField
();
array_push
(
$list
,(
object
)
array
(
'name'
=>
"Αριθμός Αιτήσεων B' περιόδου"
,
'numStudents'
=>
$numApplications
));
//υπολογισμός αριθμού χρηστών
$sCon
=
$this
->
connection
->
select
(
'epal_users'
,
'eUser'
)
->
fields
(
'eUser'
,
array
(
'id'
));
$numUsers
=
$sCon
->
countQuery
()
->
execute
()
->
fetchField
();
$list
=
array
();
array_push
(
$list
,(
object
)
array
(
'name'
=>
"Αριθμός Αιτήσεων"
,
'numStudents'
=>
$numApplications
));
array_push
(
$list
,(
object
)
array
(
'name'
=>
"Αριθμός Εγγεγραμένων Χρηστών"
,
'numStudents'
=>
$numUsers
));
array_push
(
$list
,(
object
)
array
(
'name'
=>
"Αριθμός Εγγεγραμένων Χρηστών με ρόλο Αιτούντα"
,
'numStudents'
=>
$numUsers
));
return
$this
->
respondWithStatus
(
...
...
source/components/minister/minister-informstudents.ts
View file @
698e4e7b
...
...
@@ -20,6 +20,8 @@ import { API_ENDPOINT } from '../../app.settings';
class = "loading" *ngIf="successSending == -2" >
</div>
<div style="min-height: 400px;">
<div id="emaiSentNotice" (onHidden)="onHidden()" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
...
...
@@ -59,6 +61,8 @@ import { API_ENDPOINT } from '../../app.settings';
</button>
</div>
</div>
`
})
...
...
source/components/minister/minister-reports.ts
View file @
698e4e7b
...
...
@@ -27,7 +27,9 @@ import { API_ENDPOINT } from '../../app.settings';
//encapsulation: ViewEncapsulation.None,
template
:
`
<div>
<div style="min-height: 500px; ">
<h5> >Επιλογή Αναφοράς<br><br></h5>
...
...
source/components/minister/minister-view.ts
View file @
698e4e7b
...
...
@@ -29,6 +29,7 @@ import { API_ENDPOINT } from '../../app.settings';
class = "loading" *ngIf=" distStatus === 'STARTED'" >
</div>
<div style="min-height: 400px;">
<div id="distributionNotice" (onHidden)="onHidden()" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-lg">
...
...
@@ -78,7 +79,7 @@ import { API_ENDPOINT } from '../../app.settings';
<div class="col-md-6">
<button type="submit" class="btn btn-lg btn-block" *ngIf="(loginInfo$ | async).size !== 0" (click)="runDistribution()" [disabled] = "!capacityDisabled" >
<button type="submit" class="btn btn-lg btn-block" *ngIf="(loginInfo$ | async).size !== 0" (click)="runDistribution()" [disabled] = "!capacityDisabled
|| secondPeriodEnabled
" >
Εκτέλεση Κατανομής Μαθητών<span class="glyphicon glyphicon-menu-right"></span>
</button>
</div>
...
...
@@ -92,6 +93,8 @@ import { API_ENDPOINT } from '../../app.settings';
</div>
</div>
`
})
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment