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

MISUV-9024 - Reporting frequency page entry point #2728

Closed
wants to merge 2 commits into from
Closed

Conversation

TomRafferty
Copy link
Contributor

No description provided.

@TomRafferty TomRafferty force-pushed the MISUV-9024 branch 2 times, most recently from a188c06 to 2d3edaf Compare January 15, 2025 13:00
Html(
s"""
<span id="one-year-opt-out-message">
${messages("nextUpdates.optOutOneYear-1", m.startYear, m.endYear)}
${link(id = Some("single-year-opt-out-warning-link"), link = controllers.optOut.routes.SingleYearOptOutWarningController.show(isAgent).url, messageKey = "nextUpdates.optOutOneYear-2")}
${messages("nextUpdates.withReportingFrequencyContent.optOutOneYear-1", m.startYear, m.endYear)}
Copy link
Contributor

@michael-hmrc michael-hmrc Jan 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

think we can simplify this a bit and move some logic out of the views.

We can we use pattern match guards to determine the most of the html and link redirects etc.

Then just pass like a model of everything into a single.

Likely can move it up once and put the logic in the controller or maybe a view model/helper of sorts.

Html(
     s"""
            <span id="one-year-opt-out-message">
                 ${messages("nextUpdates.optOutOneYear-1", m.startYear, m.endYear)}
                 ${link(id = Some("single-year-opt-out-warning-link"), link = controllers.optOut.routes.SingleYearOptOutWarningController.show(isAgent).url, messageKey = "nextUpdates.optOutOneYear-2")}
           </span>
      """
)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

formatting is a bit of a pain in github comments sorry.

@@ -59,7 +59,7 @@ class NextUpdatesController @Inject()(NoNextUpdatesView: NoNextUpdates,
}
}

def getNextUpdates(backUrl: Call, isAgent: Boolean, errorHandler: ShowInternalServerError, origin: Option[String] = None)
def getNextUpdates(backUrl: Call, isAgent: Boolean, errorHandler: ShowInternalServerError, origin: Option[String] = None, showReportingFrequencyContent: Boolean = false)
Copy link
Contributor

@michael-hmrc michael-hmrc Jan 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

think we don't need a boolean flag here as a parameter and as a suggestion can just call the feature switch inside this method?

val shouldShowReportingContent: Boolean = isEnabled(ReportingFrequencyPage)

also I try to not set default values for params unless it's for a good reason or massive syntax convenience. Helps with spotting issues sooner with the code. Since the value is not defaulted, if the value needs to be passed around a lot it explicitly defined at each point.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will look into all the comments ta 😄

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wonder what you think about something like this?

main...MISUV-9024b

@@ -127,6 +156,7 @@ <h2 class="govuk-heading-m">@messages("nextUpdates.sub-heading")</h2>
}
}

@import models.admin.ReportingFrequencyPage
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this import is not needed

nextUpdates.optOutOneYear-1 = You are currently reporting quarterly on a voluntary basis for the {0} to {1} tax year. You can choose to
nextUpdates.optOutOneYear-2 = opt out of quarterly updates and report annually instead.
nextUpdates.withReportingFrequencyContent.optOutOneYear-1 = Depending on your circumstances, you may be able to
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess with these keys -1 and -2 can they be a little bit more descriptive

maybe instead of -1 perhaps .p.message and -2 could be .p.link

Comment on lines +776 to +781
nextUpdates.withReportingFrequencyContent.optOutOneYear-2 = view and change your reporting frequency.

nextUpdates.optOutMultiYear-1 = You are currently reporting quarterly on a voluntary basis. You can choose to
nextUpdates.optOutMultiYear-2 = opt out of quarterly updates and report annually instead.
nextUpdates.withReportingFrequencyContent.optOutMultiYear-1 = Depending on your circumstances, you may be able to
nextUpdates.withReportingFrequencyContent.optOutMultiYear-2 = view and change your reporting frequency.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently i'm doing the ATs for this and I noticed that the added messages (Specifically "view and change your reporting frequency") aren't being used within the views you edited

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also can you do me a favour and add IDs to the opt in/out links in the reporting frequency page (https://github.com/hmrc/income-tax-view-change-frontend/blob/main/app/views/ReportingFrequencyView.scala.html#L61-L79) so i can get selenium to click them

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Milo, will reach out on slack - Michael has been working on an alternate implementation of this and we've been working on another branch 😄

closing this PR now and will open one from that branch, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants