Skip to content
This repository has been archived by the owner on Jan 7, 2020. It is now read-only.

EPIC-992 - Fixed re-ordering of decisions and phases #140

Merged
merged 1 commit into from
Jun 2, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions modules/core/client/app/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,15 +180,15 @@ angular
)
.constant('EAC_DECISIONS',
[
'Withdrawn',
'Certificate Not Required',
'In Progress',
'Certificate Issued',
'Certificate Refused',
'Further Assessment Required',
'Certificate Not Required',
'Certificate Expired',
'In Progress',
'Withdrawn',
'Terminated',
'Pre-EA Act Approval',
'Certificate Refused',
'Further Assessment Required'
'Pre-EA Act Approval'
]
)
.constant('CE_STAGES',
Expand Down
25 changes: 25 additions & 0 deletions modules/projects/client/controllers/projects.client.controllers.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ function controllerProjectsList2($scope, NgTableParams, Authentication, _, ENV,
projectList.typeArray = [];
projectList.phaseArray = [];
projectList.openPCPArray = [];
projectList.sortedPhaseArray = [];

$scope.$watch('projects', function(newValue) {
if (newValue) {
Expand Down Expand Up @@ -249,6 +250,30 @@ function controllerProjectsList2($scope, NgTableParams, Authentication, _, ENV,
projs.pluck('currentPhase.name').unique().value().map( function(item) {
projectList.phaseArray.push({id: item, title: item});
});

var order = ["Intake", "Determination", "Scope", "Evaluation", "Review", "Decision", "Post-Certification"];
var length = projectList.phaseArray.length;

order.forEach(function (key) {
_.find(projectList.phaseArray, function (item) {
if (item.title === key) { //if the key from order is in proj.list --> add that to the sortedPhase array.
projectList.sortedPhaseArray.push(item);
length--;
return true;
} else
return false;
});
});

if (length > 0) { //only if the length is greater than zero..
var newphaseArray = projectList.phaseArray.filter(function (item) { //if there are additional item in the projectlist.phaseArray (new phase which is not in the order array) this means a new phase is added
return order.indexOf(item.title) === -1;
});
_.each(newphaseArray, function (item) {
projectList.sortedPhaseArray.push(item);
});
}

projs.pluck('openCommentPeriod').unique().value().map( function(item) {
if (item === "" || item === "Pending" || item === "Open" || item === "Completed") { //extract without unpublished commentPeriod
projectList.openPCPArray.push({id: item, title: item});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<td header-class="'phase-col'"
data-title="'Phase'"
filter="{'currentPhase.name':'select'}"
filter-data="projectList.phaseArray"
filter-data="projectList.sortedPhaseArray"
sortable="'currentPhase.name'">{{o.currentPhase.name}}</td>
<td header-class="'decision-col'"
ng-if="environment === 'EAO'"
Expand Down