Skip to content

Fixed error that allows you to state you have more children than household members (including yourself)

El Jacoby requested to merge Issue-491 into main

License and Copyright Notice

By submitting this issue or commenting on this issue, or contributing any content to this issue, you certify under the Developer Certificate of Origin that the content you post may be licensed under GPLv3 (for code) or CC-BY-SA 4.0 International (for non-code content).

Branch Name

Issue-491

Related Issues

Closes #491

Description

This will fix multiple errors and provide proper error messages in the fourth fragment, and deal with all errors relating to being able to put in an incorrect number of people and get away with it. Previously, you were able to arrive at the fourth fragment and put in an incorrect number of people on one of the dropdowns. Currently, that should be impossible. I have worked through multiple possibilities through extensive testing.

Steps to Test

(List the steps needed to test this merge request here using bullets, for ex:)

  1. Register, put in bogus info until you get to the fourth fragment.
  2. In the number of people in your household spinner, put in "1".
  3. You should see no dropdown.
  4. Put in "2".
  5. You should see a dropdown. Write "1" in the dropdown. No error. Another will appear.
  6. Write "2" in the dropdown. There should now be an error message in red.
  7. Try to press either "NEXT" option at the bottom. They should be disabled.
  8. Now, change the number of people in your household to 2. The error should be gone. Advance to "NEXT" and come back. This should now work.
  9. Once you have returned, you should be able to set the number of children you have to "18". Say you have one child on every option.
  10. For each option (individually), say you have 20 kids while leaving the other options at 1, starting from the lowest dropdown.
  11. No matter which you are on, this should trigger the error. When switching any combination to a collective value beneath the number of people you have minus one (since the number of people in your household includes you -- note the "including you" at the top -- the rest may or may not be kids from 0 to 18), it should trigger the error. You should similarly be able to switch out of the error when fixing the mathematical mistakes, and advance to the next fragment. However, you should not be able to advance while an error is triggered.

Relevant Screenshots

(Post any relevant screenshots here.)triggering_a_dropdown_error.

Relevant Logs

D/**NumChildren Test**: 1
D/**NumChildren Test**: 2
D/**NumChildren Test**: 9
D/**NumChildren Test**: Select One
D/**NumChildren Test**: CHILDREN STORED:
    1
    2
    9
    0
D/**NumChildren Test**: CHILDREN STORED:
    1
    2
    9
    0
D/**NumChildren Test**: Num conflict in children 18!
D/**NumChildren Test**: DISABLED NEXT
D/**NumChildren Test**: CHILDREN STORED:
    1
    2
    9
    7
D/OpenGLRenderer: endAllActiveAnimators on 0xb7d97910 (DropDownListView) with handle 0xbe07a990
D/**NumChildren Test**: Num conflict in children 18!
D/**NumChildren Test**: CHILDREN STORED:
    1
    2
    9
    10
D/**NumChildren Test**: ENABLED NEXT
D/**NumChildren Test**: CHILDREN STORED:
    1
    2
    9
    1

Developer Notes

Some changes I made are listed below:

  • Made Children 1 dropdown disappear when only you are present, since we are assuming no 1-year-old infant is filling in this form.

  • Disabled the next button when there was an error is now fixed. Previously it was set to disable image scan next button but not manual input next button for putting in your barcode.

  • Added error messages and appropriate strings, previously the only indication was a toast which may not show up on an AVD, and it lacked the same sort of red text as the previous fragments had, presumably because it wouldn't disappear as easily as a toast when the user fixed the problem and this would confuse the user when the error message was still there since numbers problems are less easy to manage than filling in forms.

  • The red text here disappears when the problem is corrected regardless, and the text changes to the default text once again.

  • Added some translated strings for appropriate error messages to explain to the user why they were not allowed to advance.

  • Translated the manual_submit string in fourth fragment because someone forgot to translate that and it had a red line, and the red line annoyed me.

  • Removed comment on an accurate translation in my fragment (npc_intro string).

  • Added something that manually runs all the onItemSelectedListeners when you change the number of people in your household so you don't have to mess around with it to make the correct options show up after an error.

  • Added boolean called fixingInvalid as an exceptional scenario with an if statement to determine if we should set selection to 0 or not when running onItemSelected.

  • Switched location of resetNumChildren() to fix another problem that cropped up.

Edited by Darci Burdge

Merge request reports