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

PC-1464: Improve select your supplier question #411

Merged

Conversation

samyou-softwire
Copy link
Contributor

@samyou-softwire samyou-softwire commented Dec 11, 2024

Link to Jira ticket

Description

adds an alternative supplier page

if the user selects that they don't know they are sent here and can select any supplier

needs some extra work when displaying supplier name to ensure the correct supplier is always shown, as well as some additional work when submitting so energy suppliers see the alternative that was picked

Checklist

  • I have made any necessary updates to the documentation
  • I have checked there are no unnecessary IDE warnings in this PR
  • I have checked there are no unintentional line ending changes
  • I have added tests where applicable
  • If I have made any changes to the code, I have used the IDE auto-formatter on it
  • If I have made any changes to Python files (even if not changing any content strings), I have run make extract-translations
  • If I have made any changes to website flow, I have updated the Flow Miro Board
  • If I have made any changes to website flow, I have checked forward and back behaviour is still consistent

Screenshots

image
image
image
image

@samyou-softwire samyou-softwire self-assigned this Dec 11, 2024
@samyou-softwire samyou-softwire force-pushed the PC-1464-Improve-select-your-supplier-question branch 2 times, most recently from 0f450e8 to 479b9e5 Compare December 11, 2024 11:43
@samyou-softwire
Copy link
Contributor Author

noticed I've missed error texts, will push a fix

@samyou-softwire samyou-softwire force-pushed the PC-1464-Improve-select-your-supplier-question branch from 479b9e5 to 55db761 Compare December 11, 2024 11:51
Comment on lines 173 to 180
supplier = api.session.get_answer(self.session_id, supplier_page).get(supplier_field)
alternative_supplier = api.session.get_answer(self.session_id, alternative_supplier_page).get(
alternative_supplier_field
)

return alternative_supplier if self._did_specify_alternative() else supplier
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think there's real overhead to api.session.get_answer is there? We could be quite a bit more efficient with how many times we're calling it if so.

Copy link
Contributor Author

@samyou-softwire samyou-softwire Dec 16, 2024

Choose a reason for hiding this comment

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

don't think so too much, though it is a database call. have reworked it to cache the result

Comment on lines 215 to 217
session_data[supplier_field] = "Octopus Energy"
if self._is_utility_warehouse():
session_data["supplier"] = "E.ON Next"
session_data[supplier_field] = "E.ON Next"
Copy link
Contributor

Choose a reason for hiding this comment

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

Should these be using constants?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yep

Comment on lines 255 to 256
# where to send the user post them picking a supplier
def _post_supplier_pick_next_page(supplier):
Copy link
Contributor

Choose a reason for hiding this comment

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

Can this be named better so the comment isn't necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

looking back I don't think the comment adds much anyway. have removed it & changed the name slightly

@@ -104,7 +108,7 @@
supplier_field_shell = "Shell"
supplier_field_utilita = "Utilita"
supplier_field_utility_warehouse = "Utility Warehouse"
supplier_fields = [
supplier_fields_real = [
Copy link
Contributor

Choose a reason for hiding this comment

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

Can this be made to read a bit more naturally? Would quibble that these aren't fields, they're values

Copy link
Contributor Author

Choose a reason for hiding this comment

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

for what its worth most of these fields could be named as such, ie supplier_field_utilitia -> supplier_field_value_utilita. for now have renamed the fields to field_values

@samyou-softwire samyou-softwire force-pushed the PC-1464-Improve-select-your-supplier-question branch from 55db761 to f5869e3 Compare December 16, 2024 09:53
@samyou-softwire
Copy link
Contributor Author

translations for "Select an alternative energy supplier" have been added

@samyou-softwire samyou-softwire marked this pull request as ready for review December 16, 2024 09:56
when supplier is referenced, make a safe call that allows it to be overridden with the alternative if needed

make the check answers page for supplier send to alternative supplier if needed

overwrite supplier with alternative if necessary when generating referral
@samyou-softwire samyou-softwire force-pushed the PC-1464-Improve-select-your-supplier-question branch from f5869e3 to dc6469a Compare December 16, 2024 13:39
@samyou-softwire
Copy link
Contributor Author

@jdgage if there's nothing else & pipelines pass this should be ready to go

@samyou-softwire samyou-softwire merged commit 111673c into develop Dec 17, 2024
4 checks passed
@samyou-softwire samyou-softwire deleted the PC-1464-Improve-select-your-supplier-question branch December 17, 2024 09:22
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.

2 participants