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

Impounded address feature #760

Merged
merged 9 commits into from
Sep 25, 2023
Merged

Impounded address feature #760

merged 9 commits into from
Sep 25, 2023

Conversation

nonprofittechy
Copy link
Member

This adds a new feature that allows the interview author to control asking if an address or phone number is impounded.

New attributes:

  • ALAddress.impounded (bool)
  • ALIndividual.phone_impounded (bool)

There is a new keyword parameter for ALAddress.address_fields() and ALIndividual.address_fields(): ask_if_impounded (bool)

There is a new keyword parameter for all methods that display an address or part of an address, show_impounded. The same keyword can be used with the phone_numbers() method.

Finally, we add some new templates to allow translation of phrases related to impounded addresses:

  • ALAddress.impounded_label
  • ALAddress.impounded_output_label
  • ALIndividual.impounded_phone_output_label

Here's a short demo interview:

---
include:
  - assembly_line.yml
---
mandatory: True
code: |
  users[0].phone_number
  users[0].address.address
  ending_screen
---
sets:
  - users[0].address.address
question: |
  Your address
fields:
  - code: |
      users[0].address_fields(ask_if_impounded=True)
---
id: your contact information
question: |
  What is your contact information?
subquestion: |
  Include at least **one** way to reach you other than by mail.

  ${ collapse_template(why_contact_info_needed_template) }
fields:  
  - Mobile number: users[0].mobile_number
    required: False
  - Other phone number: users[0].phone_number
    required: False
  - My phone number is impounded: users[0].phone_impounded
    datatype: yesno
  - Email address: users[0].email    
    datatype: email
    required: False
  - Other ways to reach you: users[0].other_contact_method
    input type: area
    required: False
    help: |
      If you do not have a phone number or email, provide
      specific contact instructions. For example, use a friend's phone number.
      But the friend must be someone you can rely on to give you a
      message.
validation code: |
  if (not showifdef('users[0].phone_number') and \
      (not showifdef('users[0].mobile_number')) and \
      (not showifdef('users[0].email')) and \
      (not showifdef('users[0].other_contact_method'))):
    validation_error(word("You need to provide at least one contact method."), field="users[0].other_contact_method")
      
---
event: ending_screen
question: |
subquestion: |
  If impounded:
  
  Address: ${ users[0].address_block() }
  
  Phone: ${ users[0].phone_numbers() }
  
  For impounded information sheet:
  
  ${ users[0].address_block(show_impounded=True) }
  
  ${ users[0].phone_numbers(show_impounded=True) }

I think this is fairly safe and I'm happy with the API, but happy to let this get some feedback from our grant partners before merging.

@nonprofittechy nonprofittechy added the Needs community feedback We should ask the broader user base to make sure the feature is right before merging label Sep 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs community feedback We should ask the broader user base to make sure the feature is right before merging
Projects
None yet
Development

Successfully merging this pull request may close these issues.

General: create method on ALIndividual to handle impounded addresses
1 participant