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

Bhbc 2052 #884

Merged
merged 11 commits into from
Dec 2, 2022
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
2 changes: 1 addition & 1 deletion api/src/queries/survey/survey-occurrence-queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ export const getLatestSurveyOccurrenceSubmissionSQL = (surveyId: number): SQLSta
WHERE
os.survey_id = ${surveyId}
ORDER BY
os.event_timestamp DESC
os.event_timestamp DESC, ss.submission_status_id DESC
LIMIT 1
;
`;
Expand Down
8 changes: 5 additions & 3 deletions api/src/services/validation-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,17 +98,19 @@ export class ValidationService extends DBService {
const csvState = this.validateDWC(dwcPrep.archive);
// update submission
await this.persistValidationResults(csvState.csv_state, csvState.media_state);

await this.occurrenceService.updateSurveyOccurrenceSubmission(
submissionId,
dwcPrep.archive.rawFile.fileName,
dwcPrep.s3InputKey
);

// Parse Archive into JSON file for custom validation
await this.parseDWCToJSON(submissionId, dwcPrep.archive);
// insert validated status
await this.submissionRepository.insertSubmissionStatus(submissionId, SUBMISSION_STATUS_TYPE.TEMPLATE_VALIDATED);

// Parse Archive into JSON file for custom validation
await this.parseDWCToJSON(submissionId, dwcPrep.archive);

await this.templateScrapeAndUploadOccurrences(submissionId);
} catch (error) {
if (error instanceof SubmissionError) {
Expand All @@ -133,7 +135,7 @@ export class ValidationService extends DBService {
// template transformation
await this.templateTransformation(submissionId, submissionPrep.xlsx, submissionPrep.s3InputKey, surveyId);

// insert template validated status
// insert template transformed status
await this.submissionRepository.insertSubmissionStatus(submissionId, SUBMISSION_STATUS_TYPE.TEMPLATE_TRANSFORMED);

// occurrence scraping
Expand Down