Skip to content

Commit

Permalink
Merge tag '0.9.1' into develop
Browse files Browse the repository at this point in the history
 #560 Safeguards around assessments and notifications
  • Loading branch information
warrensearle committed Jun 9, 2020
2 parents c2ae84b + a38d811 commit 4e193ca
Show file tree
Hide file tree
Showing 5 changed files with 85 additions and 9 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.9.0",
"version": "0.9.1",
"private": true,
"scripts": {
"serve": "vue-cli-service serve --mode develop",
Expand Down
6 changes: 5 additions & 1 deletion src/components/ActionButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<button
class="govuk-button jac-actionbutton"
:class="computedClasses"
:disabled="isLoading"
:disabled="isLoading || disabled"
v-on="listeners"
>
<span
Expand Down Expand Up @@ -41,6 +41,10 @@ export default {
type: String,
default: 'secondary',
},
disabled: {
type: Boolean,
default: false,
},
},
data: () => ({
isLoading: false,
Expand Down
4 changes: 2 additions & 2 deletions src/store/stage/review.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ export default {
let firestoreRef = collectionRef
.where('exercise.id', '==', exerciseId)
.where('stage', '==', EXERCISE_STAGE.REVIEW)
.where('active', '==', true)
.limit(50);
.where('active', '==', true);
// .limit(50);

return bindFirestoreRef('records', firestoreRef, { serialize: vuexfireSerialize });
}),
Expand Down
66 changes: 62 additions & 4 deletions src/views/Exercises/Show/IndependentAssessments.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,28 @@
<div
v-if="!hasInitialisedAssessments"
>
<select
id="exercise-stage"
v-model="exerciseStage"
class="govuk-select govuk-!-margin-right-3"
>
<option value="">
Choose applications
</option>
<option value="review">
Review ({{ exercise.applicationRecords.review }})
</option>
<option value="shortlisted">
Shortlisted ({{ exercise.applicationRecords.shortlisted }})
</option>
<option value="selected">
Selected ({{ exercise.applicationRecords.selected }})
</option>
</select>

<ActionButton
type="primary"
:disabled="!exerciseStage"
@click="initialiseAssessments()"
>
Start Assessments
Expand All @@ -45,11 +65,26 @@

<div v-else>
<ActionButton
v-if="canCancelAssessments"
class="govuk-!-margin-right-3"
@click="cancelAssessments()"
>
Cancel Assessments
</ActionButton>
<ActionButton
v-if="canSendRequestsToAll"
type="primary"
@click="sendRequests()"
@click="sendRequestsToAll()"
>
Send to all
</ActionButton>
<ActionButton
v-if="canSendRemindersToAll"
type="primary"
@click="sendRemindersToAll()"
>
Send reminders
</ActionButton>

<table class="govuk-table">
<thead class="govuk-table__head">
Expand Down Expand Up @@ -225,6 +260,11 @@ export default {
ActionButton,
DownloadLink,
},
data() {
return {
exerciseStage: '',
};
},
computed: {
exercise() {
return this.$store.state.exerciseDocument.record;
Expand All @@ -247,6 +287,15 @@ export default {
onStaging() {
return window.location.href.indexOf('admin-staging') > 0;
},
canCancelAssessments() {
return this.hasInitialisedAssessments; // && !(this.exercise.assessments && this.exercise.assessments.sent);
},
canSendRequestsToAll() {
return this.hasInitialisedAssessments && !(this.exercise.assessments && this.exercise.assessments.sent);
},
canSendRemindersToAll() {
return this.hasInitialisedAssessments && (this.exercise.assessments && this.exercise.assessments.sent);
},
},
created() {
this.$store.dispatch('assessments/bind', { exerciseId: this.exercise.id });
Expand All @@ -257,13 +306,22 @@ export default {
},
methods: {
async initialiseAssessments() {
await functions.httpsCallable('initialiseAssessments')({ exerciseId: this.exercise.id });
if (!this.exerciseStage) {
return false;
}
await functions.httpsCallable('initialiseAssessments')({ exerciseId: this.exercise.id, stage: this.exerciseStage });
},
async cancelAssessments() {
await functions.httpsCallable('cancelAssessments')({ exerciseId: this.exercise.id });
},
async sendRequests() {
async sendRequestsToAll() {
await functions.httpsCallable('sendAssessmentRequests')({ exerciseId: this.exercise.id });
},
async sendRemindersToAll() {
await functions.httpsCallable('sendAssessmentReminders')({ exerciseId: this.exercise.id });
},
async resendRequest(assessmentId) {
await functions.httpsCallable('sendAssessmentRequests')({ exerciseId: this.exercise.id, assessmentId: assessmentId });
await functions.httpsCallable('sendAssessmentRequests')({ exerciseId: this.exercise.id, assessmentId: assessmentId, resend: true });
},
async sendReminder(assessmentId) {
await functions.httpsCallable('sendAssessmentReminders')({ exerciseId: this.exercise.id, assessmentId: assessmentId });
Expand Down
16 changes: 15 additions & 1 deletion src/views/NotificationsList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
/>

<table
v-if="activeTab === 'queue'"
v-if="activeTab === 'queue' && notificationsQueue.length"
class="govuk-table"
>
<thead class="govuk-table__head">
Expand Down Expand Up @@ -85,6 +85,10 @@
</tbody>
</table>

<p v-if="activeTab === 'queue' && !notificationsQueue.length">
No notifications in queue
</p>

<table
v-if="activeTab === 'sent'"
class="govuk-table"
Expand All @@ -97,6 +101,12 @@
>
Created
</th>
<th
scope="col"
class="govuk-table__header"
>
Sent
</th>
<th
scope="col"
class="govuk-table__header"
Expand All @@ -120,11 +130,15 @@
<td class="govuk-table__cell">
{{ notification.createdAt | formatDate('datetime') }}
</td>
<td class="govuk-table__cell">
{{ notification.sentAt | formatDate('datetime') }}
</td>
<td class="govuk-table__cell">
{{ notification.template.name }}
</td>
<td class="govuk-table__cell">
{{ notification.email }}
<span v-if="notification.email != notification.sentTo">({{ notification.sentTo }})</span>
</td>
</tr>
</tbody>
Expand Down

0 comments on commit 4e193ca

Please sign in to comment.