Skip to content

Commit

Permalink
#1883 Backwards compatibility for QTs (#1919)
Browse files Browse the repository at this point in the history
* Past tasks should default to data entry only

* Tasks should support existing QTs

* Status updates should be optional for past tasks

* Change text BAME to ethinc minority

* Update expired task message

* Lint fixes
  • Loading branch information
warrensearle authored Feb 28, 2023
1 parent ae0ad12 commit fcffc1d
Show file tree
Hide file tree
Showing 9 changed files with 433 additions and 9 deletions.
6 changes: 6 additions & 0 deletions src/helpers/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,18 @@ const OFFENCE_CATEGORY = {
MIXED: 'mixed',
};

const TASK_QT_MAP = {};
TASK_QT_MAP[TASK_TYPE.CRITICAL_ANALYSIS] = QUALIFYING_TEST.TYPE.CRITICAL_ANALYSIS;
TASK_QT_MAP[TASK_TYPE.SITUATIONAL_JUDGEMENT] = QUALIFYING_TEST.TYPE.SITUATIONAL_JUDGEMENT;
TASK_QT_MAP[TASK_TYPE.SCENARIO] = QUALIFYING_TEST.TYPE.SCENARIO;

export {
STATUS,
EXERCISE_STAGE,
APPLICATION_STATUS,
APPLICATION_SUCCESS_STATUSES,
TASK_TYPE,
TASK_QT_MAP,
SHORTLISTING,
QUALIFYING_TEST,
QUALIFYING_TEST_RESPONSE,
Expand Down
3 changes: 3 additions & 0 deletions src/store/qualifyingTest/qualifyingTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ export default {
bindQTs: firestoreAction(({ bindFirestoreRef, state }, params) => {
let firestoreRef = collection
.where('vacancy.id', '==', params.exerciseId);
if (params.type) {
firestoreRef = firestoreRef.where('type', '==', params.type);
}
firestoreRef = tableQuery(state.records, firestoreRef, params);
return bindFirestoreRef('records', firestoreRef, { serialize: vuexfireSerialize });
}),
Expand Down
2 changes: 1 addition & 1 deletion src/views/Exercise/Reports/MeritList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ export default {
// Default sort by total score (initially)
columns.push({ title: 'Total Score', sort: 'totalScore', direction: 'desc', default: true, class: 'text-center' });
columns.push({ title: 'Female' });
columns.push({ title: 'BAME' });
columns.push({ title: 'Ethnic minority' });
columns.push({ title: 'Solicitor' });
columns.push({ title: 'Disability' });
return columns;
Expand Down
82 changes: 82 additions & 0 deletions src/views/Exercise/Tasks/Task/Data/AddMarkingSchemeItem.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
<template>
<Form
@save="save"
@cancel="cancel"
>
<Select
id="type"
v-model="formData.type"
label="Please select a type"
required
>
<option
v-for="type in types"
:key="type.value"
:value="type.value"
>
{{ type.title }}
</option>
</Select>

<TextField
id="title"
v-model="formData.title"
type="text"
label="Title"
required
/>
<TextField
id="ref"
v-model="formData.ref"
type="text"
label="Ref"
required
/>
<Checkbox
id="exclude-from-score"
v-model="formData.excludeFromScore"
>
Exclude from score?
</Checkbox>
</Form>
</template>

<script>
import Form from '@/components/Page/Form';
import Select from '@jac-uk/jac-kit/draftComponents/Form/Select';
import TextField from '@jac-uk/jac-kit/draftComponents/Form/TextField';
import Checkbox from '@jac-uk/jac-kit/draftComponents/Form/Checkbox';
export default {
name: 'SelectPanel',
components: {
Form,
Select,
TextField,
Checkbox,
},
extends: Form,
data() {
return {
types: [
{
value: 'grade',
title: 'Grade',
},
{
value: 'bool',
title: 'Boolean',
},
{
value: 'number',
title: 'Number',
},
// {
// value: 'select',
// title: 'Choice',
// },
],
};
},
};
</script>
160 changes: 159 additions & 1 deletion src/views/Exercise/Tasks/Task/Data/Initialised.vue
Original file line number Diff line number Diff line change
@@ -1,3 +1,161 @@
<template>
<p>[ Data entry: configure settings - e.g. marking scheme ]</p>
<div>
<div class="govuk-grid-row">
<div class="govuk-grid-column-one-half">
<h1 class="govuk-heading-l">
{{ type | lookup }}
</h1>
</div>
<div class="text-right govuk-grid-column-one-half">
<ActionButton
class="govuk-!-margin-bottom-1"
type="primary"
@click="btnContinue"
>
Continue
</ActionButton>
</div>
</div>
<p class="govuk-body-l govuk-!-margin-bottom-4">
Please check the marking scheme is correct then press Continue
</p>

<div
v-for="group in markingScheme"
:key="group.ref"
>
<Table
data-key="ref"
:data="group.children"
:columns="[
{ title: $options.filters.lookup(group.ref) },
{ title: '' },
{ title: '' },
]"
local-data
>
<template #row="{row, index}">
<TableCell>
{{ row.ref | lookup }}
</TableCell>
<TableCell>
{{ row.type | lookup }}
</TableCell>
<TableCell>
<ActionButton
class="govuk-!-margin-bottom-0"
@click="btnRemove(group, index)"
>
Remove
</ActionButton>
</TableCell>
</template>
</Table>

<button
type="button"
class="govuk-button govuk-button--secondary govuk-!-margin-bottom-0"
@click="btnAdd(group)"
>
Add
</button>
</div>

<Modal ref="modalAddMarkingSchemeItem">
<TitleBar>
Add to marking scheme
</TitleBar>
<AddMarkingSchemeItem
class="govuk-!-margin-6"
@save="btnSave"
@cancel="btnCancelAdd"
/>
</Modal>
</div>
</template>

<script>
import { beforeRouteEnter, btnNext } from '../helper';
import ActionButton from '@jac-uk/jac-kit/draftComponents/ActionButton';
import Table from '@jac-uk/jac-kit/components/Table/Table';
import TableCell from '@jac-uk/jac-kit/components/Table/TableCell';
import Modal from '@jac-uk/jac-kit/components/Modal/Modal';
import TitleBar from '@/components/Page/TitleBar';
import AddMarkingSchemeItem from './AddMarkingSchemeItem';
import { functions } from '@/firebase';
export default {
components: {
ActionButton,
Table,
TableCell,
Modal,
TitleBar,
AddMarkingSchemeItem,
},
beforeRouteEnter: beforeRouteEnter,
props: {
type: {
required: true,
type: String,
},
},
data() {
const task = this.$store.getters['tasks/getTask'](this.type);
return {
markingScheme: task.markingScheme,
tableColumns: [
{ title: 'Criteria' },
{ title: 'Type' },
{ title: '' },
],
currentGroup: null,
};
},
computed: {
exercise() {
return this.$store.state.exerciseDocument.record;
},
task() {
return this.$store.getters['tasks/getTask'](this.type);
},
},
watch: {
task() {
this.markingScheme = this.task.markingScheme;
},
},
methods: {
btnNext,
async btnContinue() {
await functions.httpsCallable('updateTask')({
exerciseId: this.exercise.id,
type: this.type,
});
this.btnNext();
},
async btnRemove(group, rowIndex) {
group.children.splice(rowIndex, 1);
await this.$store.dispatch('task/update', { exerciseId: this.exercise.id, type: this.type, data: { markingScheme: this.markingScheme } } );
return true;
},
btnAdd(group) {
this.currentGroup = group;
this.$refs.modalAddMarkingSchemeItem.openModal();
},
async btnSave({ type, title, ref, excludeFromScore }) {
const newItem = {};
newItem.type = type;
newItem.title = title;
newItem.ref = ref;
if (excludeFromScore) newItem.excludeFromScore = excludeFromScore;
this.currentGroup.children.push(newItem);
await this.$store.dispatch('task/update', { exerciseId: this.exercise.id, type: this.type, data: { markingScheme: this.markingScheme } } );
this.$refs.modalAddMarkingSchemeItem.closeModal();
},
btnCancelAdd() {
this.$refs.modalAddMarkingSchemeItem.closeModal();
},
},
};
</script>
38 changes: 33 additions & 5 deletions src/views/Exercise/Tasks/Task/New.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,17 @@
import { beforeRouteEnter, getExpectedRouteName } from './helper';
import { TASK_TYPE } from '@/helpers/constants';
import defaultView from './New/default';
import expired from './New/expired';
import expiredQT from './New/expiredQT';
import qualifyingTest from './New/qualifyingTest';
import { isDateInFuture } from '@jac-uk/jac-kit/helpers/date';
import { getTimelineTasks } from '@/helpers/exerciseHelper';
export default {
components: {
defaultView,
expired,
expiredQT,
qualifyingTest,
},
beforeRouteEnter: beforeRouteEnter,
Expand All @@ -27,12 +33,34 @@ export default {
},
},
computed: {
exercise() {
return this.$store.state.exerciseDocument.record;
},
timelineTasks() {
return getTimelineTasks(this.exercise, this.type);
},
taskIsOverdue() {
const timelineTask = this.timelineTasks[0];
if (!timelineTask) return false;
return !isDateInFuture(timelineTask.date);
},
newView() {
switch (this.type) {
case TASK_TYPE.QUALIFYING_TEST:
return 'qualifyingTest';
default:
return 'defaultView';
if (this.taskIsOverdue) {
switch (this.type) {
case TASK_TYPE.CRITICAL_ANALYSIS:
case TASK_TYPE.SITUATIONAL_JUDGEMENT:
case TASK_TYPE.SCENARIO:
return 'expiredQT';
default:
return 'expired';
}
} else {
switch (this.type) {
case TASK_TYPE.QUALIFYING_TEST:
return 'qualifyingTest';
default:
return 'defaultView';
}
}
},
},
Expand Down
Loading

0 comments on commit fcffc1d

Please sign in to comment.