Skip to content

Commit

Permalink
Merge branch 'develop' into unit_tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tomlovesgithub authored Sep 10, 2020
2 parents 756212d + f52ea86 commit 07eff1f
Show file tree
Hide file tree
Showing 11 changed files with 364 additions and 66 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "apply-admin",
"version": "0.26.0",
"version": "0.27.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve --mode develop",
Expand Down
3 changes: 0 additions & 3 deletions src/components/RepeatableFields/SelectionCriterion.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@ export default {
},
},
computed: {
selectionCriterionTitle() {
return `selection_criterion_title_${this.index}`;
},
selectionCriterionText() {
return `selection_criterion_text_${this.index}`;
},
Expand Down
88 changes: 88 additions & 0 deletions src/components/RepeatableFields/WorkingPreferenceQuestion.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
<template>
<fieldset class="govuk-fieldset govuk-!-margin-bottom-5">
<legend class="govuk-fieldset__legend govuk-fieldset__legend--l">
<h3 class="govuk-fieldset__heading">
Custom question
</h3>
</legend>
<TextField
id="working-preference-topic"
v-model="row.topic"
hint="This will be used as the title of links to this question - e.g. Division preferences"
label="Preference type"
/>

<TextField
id="working-preference-question"
v-model="row.question"
label="What question would you like to ask?"
/>
<RadioGroup
id="working-preference-question-type"
v-model="row.questionType"
label="How would you like the question answered?"
:messages="{
required: 'Please choose one of the following options'
}"
>
<RadioItem
value="single-choice"
label="Single choice"
/>
<RadioItem
value="multiple-choice"
label="Multiple choice"
/>
<RadioItem
value="ranked-choice"
label="Ranked choice"
/>
</RadioGroup>
<RepeatableFields
v-model="row.answers"
:component="repeatableFields.Answer"
ident="answer"
type-name="answer"
required
/>
<slot name="removeButton" />
<hr class="govuk-section-break govuk-section-break--visible">
</fieldset>
</template>

<script>
import TextField from '@/components/Form/TextField';
import RadioGroup from '@/components/Form/RadioGroup';
import RadioItem from '@/components/Form/RadioItem';
import RepeatableFields from '@/components/RepeatableFields';
import Answer from '@/components/RepeatableFields/Answer';
export default {
name: 'SelectionCriterion',
components: {
TextField,
RepeatableFields,
RadioGroup,
RadioItem,
},
props: {
row: {
required: true,
type: Object,
},
index: {
required: true,
type: Number,
},
},
data() {
return {
repeatableFields: {
Answer,
},
};
},
computed: {
},
};
</script>
2 changes: 2 additions & 0 deletions src/filters.js
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,8 @@ const lookup = (value) => {
lookup[QUALIFYING_TEST.STATUS.ACTIVATED] = 'Activated';
lookup[QUALIFYING_TEST.STATUS.COMPLETED] = 'Completed';
lookup[QUALIFYING_TEST.STATUS.PAUSED] = 'Paused';
lookup[QUALIFYING_TEST.STATUS.STARTED] = 'Started';
lookup[QUALIFYING_TEST.STATUS.PROGRESS] = 'In Progess';

lookup[QUALIFYING_TEST.TYPE.SCENARIO] = 'Scenario';
lookup[QUALIFYING_TEST.TYPE.CRITICAL_ANALYSIS] = 'Critical analysis';
Expand Down
2 changes: 2 additions & 0 deletions src/helpers/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ const QUALIFYING_TEST = {
INITIALISED: 'initialised',
ACTIVATED: 'activated',
PAUSED: 'paused',
STARTED: 'started',
PROGRESS: 'in-progress',
COMPLETED: 'completed',
},
};
Expand Down
20 changes: 17 additions & 3 deletions src/store/qualifyingTest/qualifyingTestResponses.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { firestore } from '@/firebase';
import { firestoreAction } from 'vuexfire';
import vuexfireSerialize from '@/helpers/vuexfireSerialize';
import tableQuery from '@/helpers/tableQuery';
import { QUALIFYING_TEST } from '@/helpers/constants';

const collectionRef = firestore.collection('qualifyingTestResponses');

Expand All @@ -10,8 +11,10 @@ export default {
actions: {
bind: firestoreAction(({ bindFirestoreRef, state }, params ) => {

const isSeachAdjustment = params.searchStatus === 'reasonable-adjustments';
const isSearchStatus = params.searchStatus !== 'all' && !isSeachAdjustment && params.searchStatus !== '';
const isSearchAdjustment = params.searchStatus === 'reasonable-adjustments';
const isSearchStarted = params.searchStatus === QUALIFYING_TEST.STATUS.STARTED;
const isSearchInProgress = params.searchStatus === QUALIFYING_TEST.STATUS.PROGRESS;
const isSearchStatus = params.searchStatus !== 'all' && !isSearchAdjustment && params.searchStatus !== '' && !isSearchStarted && !isSearchInProgress;

let firestoreRef = collectionRef
.where('qualifyingTest.id', '==', params.qualifyingTestId);
Expand All @@ -21,11 +24,22 @@ export default {
.where('status', '==', params.searchStatus);
}

if (isSeachAdjustment) {
if (isSearchAdjustment) {
firestoreRef = firestoreRef
.where('candidate.reasonableAdjustments', '==', true);
}

if (isSearchStarted) {
firestoreRef = firestoreRef
.where('statusLog.started', '>', new Date('1900-01-01')) // INCLUDE all items with a valid date - not null and not ''
.orderBy('statusLog.started');
}

if (isSearchInProgress) {
firestoreRef = firestoreRef
.where('status', '==', QUALIFYING_TEST.STATUS.STARTED);
}

firestoreRef = tableQuery(state.records, firestoreRef, params);

return bindFirestoreRef('records', firestoreRef, { serialize: vuexfireSerialize });
Expand Down
15 changes: 15 additions & 0 deletions src/views/Exercises/Edit/WorkingPreferences.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
v-model="exercise.locationQuestionAnswers"
:component="repeatableFields.Answer"
ident="location"
type-name="answer"
required
/>
</fieldset>
Expand Down Expand Up @@ -89,10 +90,21 @@
v-model="exercise.jurisdictionQuestionAnswers"
:component="repeatableFields.Answer"
ident="jurisdiction"
type-name="answer"
required
/>
</fieldset>

<hr class="govuk-section-break govuk-section-break--visible govuk-!-margin-bottom-5">

<RepeatableFields
v-model="exercise.additionalWorkingPreferences"
:component="repeatableFields.WorkingPreferenceQuestion"
ident="additional-working-preferences"
type-name="question"
:allow-empty="true"
/>

<button class="govuk-button">
Save and continue
</button>
Expand All @@ -109,6 +121,7 @@ import RadioGroup from '@/components/Form/RadioGroup';
import RadioItem from '@/components/Form/RadioItem';
import RepeatableFields from '@/components/RepeatableFields';
import Answer from '@/components/RepeatableFields/Answer';
import WorkingPreferenceQuestion from '@/components/RepeatableFields/WorkingPreferenceQuestion';
import BackLink from '@/components/BackLink';
export default {
Expand All @@ -129,12 +142,14 @@ export default {
jurisdictionQuestion: null,
jurisdictionQuestionType: 'single-choice',
jurisdictionQuestionAnswers: null,
additionalWorkingPreferences: [],
};
const data = this.$store.getters['exerciseDocument/data']();
const exercise = { ...defaults, ...data };
return {
repeatableFields: {
Answer,
WorkingPreferenceQuestion,
},
exercise: exercise,
};
Expand Down
24 changes: 14 additions & 10 deletions src/views/Exercises/Show.vue
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
title="Applications"
/>
<Navigation
v-if="exercise.applicationRecords"
:pages="exerciseTasksNavigation"
title="Tasks"
/>
Expand Down Expand Up @@ -192,23 +191,28 @@ export default {
];
},
exerciseTasksNavigation(){
return [
{
title: 'Independent Assessments',
name: 'exercise-tasks-independent-assessments',
},
const tasks = [
{
title: 'Qualifying Tests',
name: 'exercise-tasks-qualifying-tests',
params: {
nav: '/tasks/qualifying-tests',
},
},
{
title: 'Character Checks',
name: 'exercise-tasks-character-checks',
},
];
if (this.exercise.applicationRecords) {
tasks.push(
{
title: 'Independent Assessments',
name: 'exercise-tasks-independent-assessments',
},
{
title: 'Character Checks',
name: 'exercise-tasks-character-checks',
},
);
}
return tasks;
},
applicationStageNavigation(){
if (this.exercise.applicationRecords){
Expand Down
29 changes: 29 additions & 0 deletions src/views/Exercises/Show/WorkingPreferences.vue
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,35 @@
</dd>
</div>
</dl>
<dl
v-for="(additionalWorkingPreference, index) in exercise.additionalWorkingPreferences"
:key="index"
class="govuk-summary-list"
>
<div class="govuk-summary-list__row">
<dt class="govuk-summary-list__key">
{{ additionalWorkingPreference.topic }}
</dt>
<dd class="govuk-summary-list__value">
{{ additionalWorkingPreference.question }}
</dd>
</div>
<div class="govuk-summary-list__row">
<dt class="govuk-summary-list__key">
{{ additionalWorkingPreference.questionType | lookup }}
</dt>
<dd class="govuk-summary-list__value">
<ul class="govuk-list">
<li
v-for="(answer, answerIndex) in additionalWorkingPreference.answers"
:key="answerIndex"
>
{{ answer.answer }}
</li>
</ul>
</dd>
</div>
</dl>
</div>
</template>

Expand Down
Loading

0 comments on commit 07eff1f

Please sign in to comment.