Пример #1
0
def test_not_select_all_individuals_one_of_choice():
    """Ensure that one of the individuals in the total list are selected when that one is chosen."""
    chosen_list = ["Second Person"]
    total_list = [
        constants.markers.All_Individuals, "First Person", "Second Person"
    ]
    final_list = interface.create_individuals_list(chosen_list, total_list)
    assert final_list is not None
    assert len(final_list) == 1
    assert "Second Person" in final_list
Пример #2
0
def select_individuals(dataframe: DataFrame) -> List[str]:
    """Interactively select the individuals who will receive the SMS messages."""
    # extract all of the individual names from the dataframe
    individual_names_series = extract.get_individual_names(dataframe)
    individual_names_list = extract.convert_series_to_list(
        individual_names_series)
    # prepend the "All Individuals" option to the list of choices for
    # the user so that a person does not have to select every person
    # in order to send the SMS to all people in the spreadsheet
    individual_names_list.insert(constants.sizes.First,
                                 constants.markers.All_Individuals)
    # allow the user to perform the fuzzy selection of individuals
    chosen_individual_names_list = interface.perform_fuzzy_selection(
        individual_names_list)
    # if "All Individuals" was selected, then make sure to return every
    # individual in the spreadsheet instead of returning the label
    # "All Individuals", which is only a convenience marker for users
    # Note that create_individuals_list assumes that the marker
    # "All Individuals" is always going to be individual_names_list
    return interface.create_individuals_list(chosen_individual_names_list,
                                             individual_names_list)