Skip to content

Commit

Permalink
GFORMS-3068 - Restore dataRetrieves from snapshot forms (#2353)
Browse files Browse the repository at this point in the history
  • Loading branch information
cmanson authored Dec 19, 2024
1 parent 4202acc commit d9ed694
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -659,7 +659,10 @@ case class AuthCacheWithoutForm(
def toAuthCacheWithForm(form: Form, accessCode: Option[AccessCode]) =
AuthCacheWithForm(
retrievals,
dataRetrieve.fold(form)(_ => form.copy(thirdPartyData = form.thirdPartyData.copy(dataRetrieve = dataRetrieve))),
dataRetrieve.fold(form) { dr =>
val combined: Map[DataRetrieveId, DataRetrieveResult] = form.thirdPartyData.dataRetrieve.fold(dr)(_ ++ dr)
form.copy(thirdPartyData = form.thirdPartyData.copy(dataRetrieve = Some(combined)))
},
FormTemplateContext.basicContext(formTemplate, None),
role,
accessCode,
Expand Down
4 changes: 3 additions & 1 deletion app/uk/gov/hmrc/gform/eval/InitFormEvaluator.scala
Original file line number Diff line number Diff line change
Expand Up @@ -172,5 +172,7 @@ object InitFormEvaluator {
}
}
}
} yield cache.copy(dataRetrieve = Some(results.map(r => r.id -> r).toMap))
} yield
if (results.isEmpty) cache
else cache.copy(dataRetrieve = Some(results.map(r => r.id -> r).toMap))
}

0 comments on commit d9ed694

Please sign in to comment.