Skip to content

Commit

Permalink
Feature/equal merit tie breakers (#1261)
Browse files Browse the repository at this point in the history
* Bug Fix - wrong version of jac-kit being used

* resolve some npm warnings that appear during compilation

* Bug Fix - view QT - if there are no applications the page would not load
Now the page loads and displays a warning message on-screen

* WIP

* don't allow EM tie-breakers to be created for an exercise if it has no QTs

* Bug Fix - if you create a Tie-breaker it is saved as a QT

* EM tie-breakers - don't allow start or end date to be outside of the Equal Marit Second Stage date-range for the exercise.

* simplified some logic

* do not allow a tie-breaker to be opened while they are open QTs

* EM tie-breakers - Create New - stopped passing this.isTieBreakers prop across as it set in router anyway

* WIP

* simplified some boolean logic

* new Equal Merit Tie-breaker reports

* show a warning message if tie-breaker test can't be opened yet due to open QTs

* Bug Fix - when viewing a tie-breaker where the Open Tests button was (correctly) disabled, the button would become enabled if you refreshed the page.

* when creating a tie-breaker test, default the start and end date to the Equal Merit Second Stage start and end date (for the exercise)

* specified which versions of vue loader to use

* WIP

* allow tie-breakers to be created even if there are no QTs for the exercise

* When creating a tie-breaker force it to be a Scenario type of test

* tidy-up

* Tie-breaker - when creating tests, only consider EMP candidates

* typo

* when creating a tie-breaker show the Scenario option and choose it automatically.

* Update package lock

* Router.js fix

* Router.js fix

* Revert part "Router.js fix"

This reverts part of commit 854326c.

* EM Tie-Breaker - allow tests to be setup after the EM date-range

Co-authored-by: Darrel Anthony <darrel.anthony@newsco-software.co.uk>
Co-authored-by: Warren Searle <warren@precise-minds.co.uk>
Co-authored-by: Adam Lewis <adam@anlewis.co>
  • Loading branch information
4 people authored Jul 30, 2021
1 parent a057cc1 commit 8bc9644
Show file tree
Hide file tree
Showing 20 changed files with 569 additions and 240 deletions.
242 changes: 95 additions & 147 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
"jspdf": "^1.5.3",
"save-file": "^2.3.1",
"vue": "^2.6.12",
"vue-loader": "^15.9.2",
"vue-loader-v16": "^16.0.0-beta.5.4",
"vue-json-pretty": "^1.7.1",
"vue-router": "^3.5.1",
"vuex": "^3.6.2",
Expand Down
173 changes: 172 additions & 1 deletion src/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ import ExerciseReportsAgency from '@/views/Exercise/Reports/Agency';
import ExerciseReportsHandover from '@/views/Exercise/Reports/Handover';
import QualifyingTestReportCreate from '@/views/Exercise/Reports/QualifyingTestReports/Create';
import QualifyingTestReport from '@/views/Exercise/Reports/QualifyingTestReports/QualifyingTestReport';
import QualifyingTestReports from '@/views/Exercise/Reports/QualifyingTestReports/QualifyingTestReports';
import QualifyingTestReportEdit from '@/views/Exercise/Reports/QualifyingTestReports/QualifyingTestReport/Edit';
import QualifyingTestReportView from '@/views/Exercise/Reports/QualifyingTestReports/QualifyingTestReport/View';
import QualifyingTestReportViewScore from '@/views/Exercise/Reports/QualifyingTestReports/QualifyingTestReport/ViewScore';
Expand All @@ -85,6 +86,7 @@ import QualifyingTestReview from '@/views/Exercise/Tasks/QualifyingTests/Qualify
import QualifyingTestResponses from '@/views/Exercise/Tasks/QualifyingTests/QualifyingTest/Responses';
import QualifyingTestResponse from '@/views/Exercise/Tasks/QualifyingTests/QualifyingTest/Response';
import QualifyingTestResponseView from '@/views/Exercise/Tasks/QualifyingTests/QualifyingTest/Response/View';
import QualifyingTestsCover from '@/views/Exercise/Tasks/QualifyingTests/Cover';

// Exercise stages
import ExerciseStages from '@/views/Exercise/Stages';
Expand Down Expand Up @@ -574,6 +576,105 @@ const router = new Router({
path: '',
redirect: 'qualifying-tests',
},
{
path: 'equal-merit-tie-breakers',
component: QualifyingTestsCover,
props: {
tieBreakers: true,
},
name: 'exercise-tasks-equal-merit-tie-breakers',
meta: {
requiresAuth: true,
title: 'Equal Merit Tie-Breakers',
},
},
{
path: 'equal-merit-tie-breakers/new',
component: QualifyingTestNew,
props: {
isTieBreaker: true,
},
name: 'equal-merit-tie-breaker-new',
meta: {
requiresAuth: true,
title: 'Equal Merit Tie-Breakers | New',
},
},
{
path: 'equal-merit-tie-breakers/:qualifyingTestId',
component: QualifyingTest,
children: [
{
path: '',
component: QualifyingTestView,
name: 'equal-merit-tie-breaker-view',
meta: {
requiresAuth: true,
title: 'Equal Merit Tie-Breaker | View',
},
},
{
path: 'edit',
component: QualifyingTestEdit,
name: 'equal-merit-tie-breaker-edit',
meta: {
requiresAuth: true,
title: 'Equal Merit Tie-Breaker | Edit',
},
},
{
path: 'build',
component: QualifyingTestQuestionBuilder,
name: 'equal-merit-tie-breaker-question-builder',
meta: {
requiresAuth: true,
title: 'Equal Merit Tie-Breaker | Question Builder',
},
},
{
path: 'dry-run',
component: QualifyingTestDryRun,
name: 'equal-merit-tie-breaker-dry-run',
meta: {
requiresAuth: true,
title: 'Equal Merit Tie-Breaker | Dry Run',
},
},
{
path: 'review',
component: QualifyingTestReview,
name: 'equal-merit-tie-breaker-review',
meta: {
requiresAuth: true,
title: 'Equal Merit Tie-Breaker | Review',
},
},
{
path: 'responses/:status',
component: QualifyingTestResponses,
name: 'equal-merit-tie-breaker-responses',
meta: {
requiresAuth: true,
title: 'Equal Merit Tie-Breaker | Responses',
},
},
{
path: 'response/:responseId',
component: QualifyingTestResponse,
children: [
{
path: '',
component: QualifyingTestResponseView,
name: 'equal-merit-tie-breaker-response-view',
meta: {
requiresAuth: true,
title: 'Equal Merit Tie-Breaker | Response View',
},
},
],
},
],
},
{
path: 'independent-assessments',
component: ExerciseTasksIndependentAssessments,
Expand Down Expand Up @@ -604,6 +705,9 @@ const router = new Router({
{
path: 'qualifying-tests',
component: QualifyingTests,
props: {
tieBreakers: false,
},
name: 'exercise-tasks-qualifying-tests',
meta: {
requiresAuth: true,
Expand All @@ -613,6 +717,9 @@ const router = new Router({
{
path: 'qualifying-tests/new',
component: QualifyingTestNew,
props: {
isTieBreaker: false,
},
name: 'qualifying-test-new',
meta: {
requiresAuth: true,
Expand Down Expand Up @@ -955,6 +1062,9 @@ const router = new Router({
{
path: '',
component: ExerciseReportsQualifyingTestReports,
props: {
tieBreakers: false,
},
meta: {
requiresAuth: true,
title: 'Qualifying Test Reports | Exercise Reports',
Expand All @@ -964,6 +1074,9 @@ const router = new Router({
path: 'create',
name: 'qualifying-test-report-create',
component: QualifyingTestReportCreate,
props: {
tieBreakers: false,
},
meta: {
requiresAuth: true,
title: 'Create Qualifying Test Report | Exercise Reports',
Expand Down Expand Up @@ -1002,8 +1115,66 @@ const router = new Router({
},
],
},
],
],
},
{
path: 'equal-merit-tie-breaker-reports',
component: QualifyingTestReports,
props: {
tieBreakers: true,
},
name: 'equal-merit-tie-breaker-reports',
meta: {
requiresAuth: true,
title: 'Equal Merit Tie-breaker Reports',
},
},
{
path: 'equal-merit-tie-breaker-report-create',
component: QualifyingTestReportCreate,
props: {
tieBreakers: true,
},
name: 'equal-merit-tie-breaker-report-create',
meta: {
requiresAuth: true,
title: 'Equal Merit Tie-breaker Report | New',
},
},
{
path: 'equal-merit-tie-breaker-reports/:qualifyingTestReportId',
component: QualifyingTestReport,
children: [
{
path: '',
component: QualifyingTestReportView,
name: 'equal-merit-tie-breaker-report-view',
meta: {
requiresAuth: true,
title: 'Equal Merit Tie-breaker Report | View',
},
},
{
path: 'edit',
component: QualifyingTestReportEdit,
name: 'equal-merit-tie-breaker-report-edit',
meta: {
requiresAuth: true,
title: 'Equal Merit Tie-breaker Report | Edit',
},
},
{
path: ':score',
component: QualifyingTestReportViewScore,
name: 'equal-merit-tie-breaker-report-view-score',
meta: {
requiresAuth: true,
title: 'Equal Merit Tie-breaker Report | View Score',
},
},
],
},

{
path: 'agency',
component: ExerciseReportsAgency,
Expand Down
5 changes: 5 additions & 0 deletions src/store/qualifyingTest/qualifyingTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,5 +90,10 @@ export default {
&& qualifyingTest.mode !== QUALIFYING_TEST.MODE.MOP_UP;
});
},
getActivatedQTs: (state) => {
return state.records.filter(qualifyingTest => {
return qualifyingTest.status === QUALIFYING_TEST.STATUS.ACTIVATED;
});
},
},
};
18 changes: 15 additions & 3 deletions src/views/Exercise/Reports/QualifyingTestReports/Create.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div class="govuk-grid-column-two-thirds">
<form @submit.prevent="validateAndSave">
<h2 class="govuk-heading-l">
Create a qualifying test
Create a {{ tieBreakers ? 'an equal merit tie-breaker' : 'a qualifying test' }} report
</h2>

<ErrorSummary
Expand Down Expand Up @@ -45,6 +45,12 @@ export default {
CheckboxItem,
},
extends: Form,
props: {
tieBreakers: {
required: true,
type: Boolean,
},
},
data(){
return {
qualifyingTestIds: [],
Expand All @@ -55,7 +61,12 @@ export default {
return this.$route.params.id;
},
qualifyingTests() {
return this.$store.getters['qualifyingTest/getCompletedQTs'];
return this.$store.getters['qualifyingTest/getCompletedQTs'].filter(row => {
return this.tieBreakers == (row.isTieBreaker == true); // to cater for the isTieBreaker field being absent
});
},
routeNamePrefix() {
return this.tieBreakers ? 'equal-merit-tie-breaker' : 'qualifying-test';
},
},
created() {
Expand All @@ -81,11 +92,12 @@ export default {
exercise: {
id: this.exerciseId,
},
tieBreakers: this.tieBreakers,
qualifyingTests: qualifyingTests,
};
await this.$store.dispatch('qualifyingTestReport/create', data);
this.$router.push({
name: 'qualifying-test-reports',
name: `${this.routeNamePrefix}-reports`,
});
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div class="govuk-grid-column-two-thirds">
<form @submit.prevent="validateAndSave">
<h2 class="govuk-heading-m govuk-!-margin-bottom-0">
Qualifying Test Report
{{ tieBreakers ? 'Equal Merit Tie-breaker' : 'Qualifying Test' }} Report
</h2>
<h3 class="govuk-heading-l ">
{{ qualifyingTestReport.title }}
Expand Down Expand Up @@ -96,11 +96,19 @@ export default {
return this.$store.state.exerciseDocument.record;
},
qualifyingTests() {
return this.$store.getters['qualifyingTest/getCompletedQTs'];
return this.$store.getters['qualifyingTest/getCompletedQTs'].filter(row => {
return this.tieBreakers == (row.isTieBreaker == true); // to cater for the isTieBreaker field being absent
});
},
qualifyingTestReport() {
return this.$store.getters['qualifyingTestReport/data'];
},
tieBreakers() {
return this.qualifyingTestReport.tieBreakers;
},
routeNamePrefix() {
return this.tieBreakers ? 'equal-merit-tie-breaker' : 'qualifying-test';
},
},
created() {
if (this.$store.state.qualifyingTest.records.length === 0) {
Expand Down Expand Up @@ -128,7 +136,7 @@ export default {
await this.$store.dispatch('qualifyingTestReport/save', data);
this.$router.push({
name: 'qualifying-test-report-view',
name: `${this.routeNamePrefix}-report-view`,
params: {
qualifyingTestReportId: this.qualifyingTestReportId,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<div class="moj-page-header-actions">
<div class="moj-page-header-actions__title">
<h2 class="govuk-heading-m">
Qualifying Test Report
{{ tieBreakers ? 'Equal Merit Tie-breaker' : 'Qualifying Test' }} Report
</h2>
<h3 class="govuk-heading-l govuk-!-margin-bottom-0">
{{ qualifyingTestReport.title }}
Expand Down Expand Up @@ -67,7 +67,7 @@
</TableCell>
<TableCell :title="tableColumns[2].title">
<RouterLink
:to="{ name: 'qualifying-test-report-view-score', params: { qualifyingTestReportId: qualifyingTestReportId, score: row.score } }"
:to="{ name: `${routeNamePrefix}-report-view-score`, params: { qualifyingTestReportId: qualifyingTestReportId, score: row.score } }"
class="govuk-link"
>
{{ row.score }}
Expand Down Expand Up @@ -151,6 +151,12 @@ export default {
});
return score;
},
tieBreakers() {
return this.qualifyingTestReport.tieBreakers;
},
routeNamePrefix() {
return this.tieBreakers ? 'equal-merit-tie-breaker' : 'qualifying-test';
},
applicationIds() {
const ids = [];
this.qualifyingTestReport.rawData.forEach(data => {
Expand All @@ -174,7 +180,7 @@ export default {
},
btnEdit() {
this.$router.push({
name: 'qualifying-test-report-edit',
name: `${this.routeNamePrefix}-report-edit`,
params: {
qualifyingTestReportId: this.qualifyingTestReportId,
},
Expand Down Expand Up @@ -233,7 +239,7 @@ export default {
];
},
downloadData() {
const title = 'Qualifying Test Report';
const title = `${this.tieBreakers ? 'Equal Merit Tie-breaker' : 'Qualifying Test'} Report`;
const data = this.gatherReportData();
downloadXLSX(
data,
Expand Down
Loading

0 comments on commit 8bc9644

Please sign in to comment.