diff --git a/UI/src/components/features/RipaFormContainer.vue b/UI/src/components/features/RipaFormContainer.vue index 542c65b2..2c13d20f 100644 --- a/UI/src/components/features/RipaFormContainer.vue +++ b/UI/src/components/features/RipaFormContainer.vue @@ -411,102 +411,116 @@ export default { result.version = 1 } - const updatedWarningCodes = result.result.warningCodes.filter( - code => { - return this.mappedFormStatutes.some(statute => { - return statute.code === code - }) - }, - ) + if (result.result.warningCodes) { + const updatedWarningCodes = result.result.warningCodes.filter( + code => { + return this.mappedFormStatutes.some(statute => { + return statute.code === code + }) + }, + ) - if ( - updatedWarningCodes.length !== result.result.warningCodes.length - ) { - result.favoritesCodeExpired = true - } + if ( + updatedWarningCodes.length !== + result.result.warningCodes.length + ) { + result.favoritesCodeExpired = true + } - result.result.warningCodes = updatedWarningCodes + result.result.warningCodes = updatedWarningCodes + } - const updatedVerbalWarningCodes = - result.result.verbalWarningCodes.filter(code => { - return this.mappedFormStatutes.some(statute => { - return statute.code === code + if (result.result.verbalWarningCodes) { + const updatedVerbalWarningCodes = + result.result.verbalWarningCodes.filter(code => { + return this.mappedFormStatutes.some(statute => { + return statute.code === code + }) }) - }) - if ( - updatedVerbalWarningCodes.length !== - result.result.verbalWarningCodes.length - ) { - result.favoritesCodeExpired = true - } + if ( + updatedVerbalWarningCodes.length !== + result.result.verbalWarningCodes.length + ) { + result.favoritesCodeExpired = true + } - result.result.verbalWarningCodes = updatedVerbalWarningCodes + result.result.verbalWarningCodes = updatedVerbalWarningCodes + } - const updatedWrittenWarningCodes = - result.result.writtenWarningCodes.filter(code => { - return this.mappedFormStatutes.some(statute => { - return statute.code === code + if (result.result.writtenWarningCodes) { + const updatedWrittenWarningCodes = + result.result.writtenWarningCodes.filter(code => { + return this.mappedFormStatutes.some(statute => { + return statute.code === code + }) }) - }) - if ( - updatedWrittenWarningCodes.length !== - result.result.writtenWarningCodes.length - ) { - result.favoritesCodeExpired = true + if ( + updatedWrittenWarningCodes.length !== + result.result.writtenWarningCodes.length + ) { + result.favoritesCodeExpired = true + } + + result.result.writtenWarningCodes = updatedWrittenWarningCodes } - result.result.writtenWarningCodes = updatedWrittenWarningCodes + if (result.result.citationCodes) { + const updatedCitationCodes = result.result.citationCodes.filter( + code => { + return this.mappedFormStatutes.some(statute => { + return statute.code === code + }) + }, + ) - const updatedCitationCodes = result.result.citationCodes.filter( - code => { - return this.mappedFormStatutes.some(statute => { - return statute.code === code - }) - }, - ) + if ( + updatedCitationCodes.length !== + result.result.citationCodes.length + ) { + result.favoritesCodeExpired = true + } - if ( - updatedCitationCodes.length !== - result.result.citationCodes.length - ) { - result.favoritesCodeExpired = true + result.result.citationCodes = updatedCitationCodes } - result.result.citationCodes = updatedCitationCodes + if (result.result.infieldCodes) { + const updatedInfieldCodes = result.result.infieldCodes.filter( + code => { + return this.mappedFormStatutes.some(statute => { + return statute.code === code + }) + }, + ) - const updatedInfieldCodes = result.result.infieldCodes.filter( - code => { - return this.mappedFormStatutes.some(statute => { - return statute.code === code - }) - }, - ) + if ( + updatedInfieldCodes.length !== + result.result.infieldCodes.length + ) { + result.favoritesCodeExpired = true + } - if ( - updatedInfieldCodes.length !== result.result.infieldCodes.length - ) { - result.favoritesCodeExpired = true + result.result.infieldCodes = updatedInfieldCodes } - result.result.infieldCodes = updatedInfieldCodes - - const updatedCustodialArrestCodes = - result.result.custodialArrestCodes.filter(code => { - return this.mappedFormStatutes.some(statute => { - return statute.code === code + if (result.result.custodialArrestCodes) { + const updatedCustodialArrestCodes = + result.result.custodialArrestCodes.filter(code => { + return this.mappedFormStatutes.some(statute => { + return statute.code === code + }) }) - }) - if ( - updatedCustodialArrestCodes.length !== - result.result.custodialArrestCodes.length - ) { - result.favoritesCodeExpired = true - } + if ( + updatedCustodialArrestCodes.length !== + result.result.custodialArrestCodes.length + ) { + result.favoritesCodeExpired = true + } - result.result.custodialArrestCodes = updatedCustodialArrestCodes + result.result.custodialArrestCodes = updatedCustodialArrestCodes + } return result }) diff --git a/UI/src/components/organisms/RipaFormWrapper.vue b/UI/src/components/organisms/RipaFormWrapper.vue index 8112f771..2769fd0d 100644 --- a/UI/src/components/organisms/RipaFormWrapper.vue +++ b/UI/src/components/organisms/RipaFormWrapper.vue @@ -749,7 +749,7 @@ export default { this.stepIndex = this.stepIndex - 2 } else if (this.model.stopVersion === 2) { this.stepIndex = this.stepIndex - 1 - } else if (!this.anyAgencyQuestions) { + } else if (!this.anyAgencyQuestions && this.stepIndex === 7) { this.stepIndex = this.stepIndex - 2 } else { this.stepIndex = this.stepIndex - 1