@@ -139,45 +139,42 @@ class HmdaFileValidator(supervisor: ActorRef, validationStats: ActorRef, submiss
139
139
override def receiveCommand : Receive = {
140
140
141
141
case BeginValidation (replyTo) =>
142
- val validationStarted = ValidationStarted (submissionId)
143
- sender() ! validationStarted
142
+ sender() ! ValidationStarted (submissionId)
144
143
events(parserPersistenceId)
145
144
.filter(x => x.isInstanceOf [TsParsed ])
146
- .map(e => e.asInstanceOf [TsParsed ].ts)
147
- .map(ts => (ts, validateTs(ts, ctx).toEither))
145
+ .map { e => e.asInstanceOf [TsParsed ].ts }
146
+ .map { ts =>
147
+ self ! ts
148
+ validationStats ! AddSubmissionTaxId (ts.taxId, submissionId)
149
+ self ! ValidateAggregate (ts)
150
+ validateTs(ts, ctx).toEither
151
+ }
148
152
.map {
149
- case (_, Right (ts)) =>
150
- validationStats ! AddSubmissionTaxId (ts.taxId, submissionId)
151
- ValidateAggregate (ts)
152
- case (ts, Left (errors)) =>
153
- validationStats ! AddSubmissionTaxId (ts.taxId, submissionId)
154
- self ! ValidateAggregate (ts)
155
- TsValidationErrors (errors.list.toList)
153
+ case Right (_) => // do nothing
154
+ case Left (errors) => TsValidationErrors (errors.list.toList)
156
155
}
157
156
.runWith(Sink .actorRef(self, NotUsed ))
158
157
159
158
val larSource : Source [LoanApplicationRegister , NotUsed ] = events(parserPersistenceId)
160
159
.filter(x => x.isInstanceOf [LarParsed ])
161
160
.map(e => e.asInstanceOf [LarParsed ].lar)
162
161
163
- larSource.map(lar => (lar, validateLar(lar, ctx).toEither))
162
+ larSource.map { lar =>
163
+ self ! lar
164
+ validateLar(lar, ctx).toEither
165
+ }
164
166
.map {
165
- case (_, Right (l)) => l
166
- case (lar, Left (errors)) => {
167
- self ! lar
168
- LarValidationErrors (errors.list.toList)
169
- }
167
+ case Right (_) => // do nothing
168
+ case Left (errors) => LarValidationErrors (errors.list.toList)
170
169
}
171
170
.runWith(Sink .actorRef(self, ValidateMacro (larSource, replyTo)))
172
171
173
172
case ValidateAggregate (ts) =>
174
173
performAsyncChecks(ts, ctx)
175
174
.map(validations => validations.toEither)
176
175
.map {
177
- case Right (_) => self ! ts
178
- case Left (errors) =>
179
- self ! TsValidationErrors (errors.list.toList)
180
- self ! ts
176
+ case Right (_) => // do nothing
177
+ case Left (errors) => self ! TsValidationErrors (errors.list.toList)
181
178
}
182
179
183
180
case ts : TransmittalSheet =>
0 commit comments