Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hotfixes #7 #1012

Merged
merged 4 commits into from
Oct 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions apollo/participants/api/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@


class ParticipantSchema(BaseModelSchema):
role = ma.fields.Method('get_role')
role = ma.fields.Method("get_role")

class Meta:
"""ParticipantSchema Meta."""

model = Participant
fields = ('id', 'full_name', 'first_name', 'other_names', 'last_name',
'participant_id', 'role')
fields = ("id", "name", "full_name", "first_name", "other_names", "last_name", "participant_id", "role")

def get_role(self, obj):
return obj.role.name
12 changes: 8 additions & 4 deletions apollo/participants/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,10 +235,14 @@ def _get_form_data(participant: Participant):
)

# get participant submissions
participant_submissions = Submission.query.join(
EventAlias,
and_(EventAlias.participant_set_id == participant.participant_set_id, Submission.event_id == EventAlias.id),
).join(FormAlias, Submission.form_id == FormAlias.id)
participant_submissions = (
Submission.query.filter(Submission.participant_id == participant.id)
.join(
EventAlias,
and_(EventAlias.participant_set_id == participant.participant_set_id, Submission.event_id == EventAlias.id),
)
.join(FormAlias, Submission.form_id == FormAlias.id)
)

# get checklist and survey forms based on the available submissions
non_incident_forms = participant_submissions.with_entities(FormAlias).distinct(FormAlias.id)
Expand Down
2 changes: 1 addition & 1 deletion apollo/pwa/static/js/serviceworker.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const CACHE_NAME = 'apollo-cache-static-v11';
const CACHE_NAME = 'apollo-cache-static-v12';

const CACHED_URLS = [
'/pwa/',
Expand Down
26 changes: 13 additions & 13 deletions apollo/pwa/templates/pwa/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ <h6 class="card-header" :class="getCompletionClass(index)"><a class="text-white"
};
if (a.form_type !== b.form_type)
return FORM_TYPE_MAP[a.form_type] - FORM_TYPE_MAP[b.form_type];

if (a.name > b.name)
return 1;
else if (a.name < b.name)
Expand Down Expand Up @@ -381,7 +381,7 @@ <h6 class="card-header" :class="getCompletionClass(index)"><a class="text-white"
acc += ((data[field.tag] !== undefined && data[field.tag] !== '') ? 1 : 0);
return acc;
}, 0);

return completion;
};

Expand All @@ -394,7 +394,7 @@ <h6 class="card-header" :class="getCompletionClass(index)"><a class="text-white"

if ((completion.total === completion.filled) && submission.passedQA)
return true;

return false;
};

Expand Down Expand Up @@ -479,7 +479,7 @@ <h6 class="card-header" :class="getCompletionClass(index)"><a class="text-white"
status = '{{ _("Partial") }}';
else
status = '{{ _("Complete") }}';

return status;
}
},
Expand Down Expand Up @@ -531,7 +531,7 @@ <h6 class="card-header" :class="getCompletionClass(index)"><a class="text-white"
return true;
else if (this.submission.updated.getTime() > this.submission.posted.getTime())
return true;

return false;
},
showQAStatus() {
Expand Down Expand Up @@ -745,7 +745,7 @@ <h6 class="card-header" :class="getCompletionClass(index)"><a class="text-white"
});
});
}

return sub;
},
newSubmission(form) {
Expand Down Expand Up @@ -847,7 +847,7 @@ <h6 class="card-header" :class="getCompletionClass(index)"><a class="text-white"
if (instance.data[field.tag] !== undefined || instance.data[field.tag] !== null) {
if ((fieldData < field.min) || (fieldData > field.max))
errorFields.push(field.tag);
else if (Number.parseInt(fieldData.toString()) !== fieldData)
else if (fieldData !== undefined && Number.parseInt(fieldData.toString()) !== fieldData)
errorFields.push(field.tag);
}
});
Expand Down Expand Up @@ -1048,18 +1048,18 @@ <h6 class="card-header" :class="getCompletionClass(index)"><a class="text-white"
return instance.submissions.filter(submission => {
if (submission.posted === null)
return true;

if (submission.updated.getTime() > submission.posted.getTime())
return true;

return false;
}).length;
},
groupedSubmissions() {
let instance = this;
if (instance.forms === null || instance.forms === [] || instance.submissions === null || instance.submissions === [])
return {};

return instance.forms.reduce((acc, form) => {
acc[form.id] = instance.submissionsSubset(form);
return acc;
Expand Down Expand Up @@ -1172,7 +1172,7 @@ <h6 class="card-header" :class="getCompletionClass(index)"><a class="text-white"
let formIds = new Set(forms.map(form => form.id));
instance._loadCollectionFromDatabase(db.forms, dbForms => {
unusedFormIds = dbForms.filter(form => !formIds.has(form.id)).map(form => form.id);

db.forms.bulkPut(forms);
db.forms.bulkDelete(unusedFormIds);

Expand Down Expand Up @@ -1410,7 +1410,7 @@ <h6 class="card-header" :class="getCompletionClass(index)"><a class="text-white"

if (instance.currentSubmission === submission)
return false;

return !submission.passedQA;
})
.forEach(submission => {
Expand Down Expand Up @@ -1449,7 +1449,7 @@ <h6 class="card-header" :class="getCompletionClass(index)"><a class="text-white"
globalStatus() {
if (this.submissions.length === 0)
return 0;

let unchangedSubmissions = this.submissions.filter(sub => sub.updated === null);
if (unchangedSubmissions.length === this.submissions.length)
return 0;
Expand Down
Loading