jac-uk / admin

The Vue SPA for managing applications and applicants
https://admin.judicialappointments.digital
MIT License
4 stars 2 forks source link

Reasonable Adjustments Report Other applications not shown #2373

Closed KoWeiJAC closed 5 months ago

KoWeiJAC commented 5 months ago

Describe the bug Sentry TypeError on production https://judicial-appointments-commissi.sentry.io/issues/5176399784/?environment=live&environment=production&project=1792541&query=is%3Aunresolved+issue.priority%3A%5Bhigh%2C+medium%5D&referrer=issue-stream&statsPeriod=14d&stream_index=3

It caused by old firebase lib syntax in the src/views/Exercise/Reports/ReasonableAdjustments.vue, it should use firebase module API

    async getOtherApplicationRecords(record) {
      const firestoreRef = firestore
        .collection('applicationRecords')
        .where('candidate.id', '==', record.candidate.id)
        .where('candidate.reasonableAdjustments', '==', true)
        .orderBy('exercise.referenceNumber', 'desc');
      const snapshot = await firestoreRef.get();
      const otherRecords = [];
      snapshot.forEach(doc => {
        const data = doc.data();
        if (data.exercise.id === record.exercise.id) {
          otherRecords.unshift(data); // put current exercise first
        } else {
          otherRecords.push(data);
        }
      });
      if (otherRecords.length) {
        this.otherApplicationRecords.push({
          candidateId: record.candidate.id,
          otherRecords,
        });
      }
    },

To Reproduce Steps to reproduce the behavior:

  1. Go to 'Reasonable Adjustments Report'
  2. Click on 'View all reasonable adjustments' Screenshot 2024-04-17 at 09.51.53.png

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context Add any other context about the problem here.