-
Notifications
You must be signed in to change notification settings - Fork 0
[NGR-2496] - Create Navigator and User Answers #32
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
Conversation
|
|
|
450ad84
to
8235a93
Compare
|
84a17fb
to
0dbd7c7
Compare
|
mode = mode | ||
))) | ||
}, | ||
rentAmount => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know it wasn't you. Can you please rename it?
def show: Action[AnyContent] = { | ||
(authenticate andThen hasLinkedProperties).async { implicit request => | ||
request.propertyLinking.map(property => | ||
//TODO Add in preparedForm |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this still need?
(formError.key, formError.messages) match | ||
case (key, messages) if messages.head.contains("rentDatesAgree.date") => | ||
setCorrectKey(formError, "rentDatesAgree", "date") | ||
case (key, messages) if messages.contains("rentDatesAgree.date.month.required.error") => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please change to the same main branch? As setCorrectKey method is doing all what you are trying to do. It's common method that can be use for setting correct field to be highlighted.
case (key, messages) if messages.contains("rentDatesAgree.date.month.required.error") => | |
case (key, messages) if messages.head.contains("rentDatesAgree.date") => | |
setCorrectKey(formError, "rentDatesAgree", "date") | |
case _ => | |
formError |
extends FrontendController(mcc) with I18nSupport with CurrencyHelper { | ||
|
||
def firstTable(userAnswers: RaldUserAnswers)(implicit messages: Messages): Table = | ||
def firstTable(userAnswers: ProvideDetailsOfFirstSecondRentPeriod)(implicit messages: Messages): Table = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please change userAnswers to something else? It's a bit confusing. Maybe rentPeriods?
) | ||
|
||
def secondTable(userAnswers: RaldUserAnswers)(implicit messages: Messages): Table = Table( | ||
def secondTable(userAnswers: ProvideDetailsOfFirstSecondRentPeriod)(implicit messages: Messages): Table = Table( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe change userAnswers to something else.
val parts = dateString.split("-").map(_.toInt) | ||
val year = parts(0).toString | ||
val month = f"${parts(1)}%02d" | ||
NGRMonthYear(month, year) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since makeString has already padding the missing 0. Maybe you can just get the value and set back into NGRMonthYear. Line 29, Can you please change getOrElse to default 1 or throw Exception. There isn't 0 month. I know it wasn't you. Sorry.
NGRMonthYear(month, year) | |
NGRMonthYear(parts(1), parts(0)) |
private val yes: NGRRadioButtons = NGRRadioButtons(radioContent = "rentPeriods.yes", radioValue = No) | ||
private val no: NGRRadioButtons = NGRRadioButtons(radioContent = "rentPeriods.no", radioValue = Yes) | ||
private val yes: NGRRadioButtons = NGRRadioButtons(radioContent = "rentPeriods.yes", radioValue = Yes) | ||
private val no: NGRRadioButtons = NGRRadioButtons(radioContent = "rentPeriods.no", radioValue = No) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well spotted!
|
||
import play.api.libs.json.* | ||
|
||
package object models { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it correct that the file name is package.scala?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, as discussed yesterday
@@ -1,283 +0,0 @@ | |||
/* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please remove the empty file?
package uk.gov.hmrc.ngrraldfrontend.pages | ||
|
||
import play.api.libs.json.JsPath | ||
import uk.gov.hmrc.ngrraldfrontend.models.{AgreementType, RaldUserAnswers} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't forget to remove RaldUserAnswers
val ngrLoginRegistrationHost: String | ||
val ngrDashboardUrl: String | ||
val ngrLogoutUrl: String | ||
val timeToLive: String |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need this timeToLive as it was used for RadlUserAnswers
override val features = new Features()(config) | ||
override val nextGenerationRatesHost: String = servicesConfig.baseUrl("next-generation-rates") | ||
override val ngrLoginRegistrationHost: String = servicesConfig.baseUrl("ngr-login-register-frontend") | ||
override val timeToLive: String = servicesConfig.getString("time-to-live.time") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same for this, this was being used for RaldUserAnswers.
conf/application.conf
Outdated
} | ||
|
||
time-to-live.time = "3" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
time-to-live.time = "3" can be removed this was for RaldUserAnswers
.map { | ||
case Some(propertyLinkingUserAnswers) => Some(propertyLinkingUserAnswers.vmvProperty) | ||
case None => throw new NotFoundException("failed to find propertyLinkingUserAnswers from backend mongo") | ||
case None => None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just thinking if we deal with the exception here we don't have to do it anywhere else this is called. And maybe in the future we should show that page was talking about to not show kibana errors.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Its been changed to None, as it was firing the exception in this file and not hitting the data retrieval action to hit the exception there. I had to do this in order to get the tests to work if a property wasn't found
val preparedForm = request.userAnswers.getOrElse(UserAnswers(request.credId)).get(AgreedRentChangePage) match { | ||
case None => form | ||
case Some(value) => form.fill(AgreedRentChangeForm(value)) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this man! big improvement!
}, value.openEndedDate match { | ||
case Some(value) => Some(NGRDate.fromString(value)) | ||
case None => None | ||
}, if (value.haveBreakClause) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm thinking storing things as boolean is making our code more annoying then good, we should raise this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I think in the future we should have some kind of standard. A lot of the radio buttons are strings which are just simple Yes or No answers. So I think we should be storing them as booleans as it makes it easier to prepopulate the form rather than having to put in the name of the radio value. If you get me. For example what your rent includes page really should just be booleans for each value not the whole value that you have to pass back
No description provided.