From cc99796f55a665876fc49480fbd077e1b3371d27 Mon Sep 17 00:00:00 2001 From: Connor Bechthold Date: Wed, 31 Jan 2024 01:21:26 -0500 Subject: [PATCH 1/2] finish seeding scripts and other bugs/improvements --- backend/app/models/residents.py | 5 +- backend/app/rest/auth_routes.py | 2 +- backend/app/rest/residents_routes.py | 6 +- .../services/interfaces/residents_service.py | 2 +- ...df27_add_unique_constraint_to_combined_.py | 43 ++++ ...hange_resident_room_number_to_be_string.py | 38 +++ db-init/create-multiple-dbs.sh | 22 ++ frontend/src/components/common/Pagination.tsx | 38 +-- .../src/components/forms/CreateResident.tsx | 2 +- .../src/components/forms/EditResident.tsx | 4 +- frontend/src/components/forms/Signup.tsx | 1 + frontend/src/types/ResidentTypes.ts | 2 +- seeding/create-log-records.sh | 239 ++++++++++++++++-- seeding/create-residents.sh | 67 ++++- seeding/create-tags.sh | 29 +++ seeding/notes.txt | 100 ++++++++ 16 files changed, 541 insertions(+), 59 deletions(-) create mode 100644 backend/migrations/versions/6ba7859cdf27_add_unique_constraint_to_combined_.py create mode 100644 backend/migrations/versions/eff8a5a7fda3_change_resident_room_number_to_be_string.py create mode 100755 db-init/create-multiple-dbs.sh create mode 100644 seeding/create-tags.sh create mode 100644 seeding/notes.txt diff --git a/backend/app/models/residents.py b/backend/app/models/residents.py index 38bddd46..d435d647 100644 --- a/backend/app/models/residents.py +++ b/backend/app/models/residents.py @@ -7,7 +7,7 @@ class Residents(db.Model): __tablename__ = "residents" id = db.Column(db.Integer, primary_key=True, nullable=False) initial = db.Column(db.String, nullable=False) - room_num = db.Column(db.Integer, nullable=False) + room_num = db.Column(db.String, nullable=False) date_joined = db.Column(db.Date, nullable=False) date_left = db.Column(db.Date, nullable=True) building_id = db.Column(db.Integer, db.ForeignKey("buildings.id"), nullable=False) @@ -22,12 +22,13 @@ class Residents(db.Model): "LogRecords", secondary="log_record_residents", back_populates="residents" ) - resident_id = db.column_property(initial + cast(room_num, String)) + resident_id = db.column_property(initial + room_num) __table_args__ = ( db.CheckConstraint( "date_left IS NULL OR date_left > date_joined", name="check_date_left_valid" ), + db.UniqueConstraint('initial', 'room_num'), ) def to_dict(self, include_relationships=False): diff --git a/backend/app/rest/auth_routes.py b/backend/app/rest/auth_routes.py index 6dbded24..22037031 100644 --- a/backend/app/rest/auth_routes.py +++ b/backend/app/rest/auth_routes.py @@ -167,7 +167,7 @@ def register(): response = {"requires_two_fa": False, "auth_user": None} - if os.getenv("TWILIO_ENABLED") == "True" and auth_dto.role == "Relief Staff": + if os.getenv("TWO_FA_ENABLED") == "True" and auth_dto.role == "Relief Staff": response["requires_two_fa"] = True return jsonify(response), 200 diff --git a/backend/app/rest/residents_routes.py b/backend/app/rest/residents_routes.py index f19d6a55..4c0b940d 100644 --- a/backend/app/rest/residents_routes.py +++ b/backend/app/rest/residents_routes.py @@ -22,7 +22,7 @@ def add_resident(): ) # Check for the existence of a resident prior to adding them - fmt_resident_id = resident.get("initial") + str(resident.get("room_num")) + fmt_resident_id = resident.get("initial") + resident.get("room_num") try: existing_resident = residents_service.get_resident_by_id(fmt_resident_id) if existing_resident: @@ -62,9 +62,7 @@ def update_resident(resident_id): ) # Check for the existence of a resident prior to adding them - fmt_resident_id = updated_resident.get("initial") + str( - updated_resident.get("room_num") - ) + fmt_resident_id = updated_resident.get("initial") + updated_resident.get("room_num") try: existing_resident = residents_service.get_resident_by_id(fmt_resident_id) if existing_resident and existing_resident["id"] != resident_id: diff --git a/backend/app/services/interfaces/residents_service.py b/backend/app/services/interfaces/residents_service.py index 094757dc..fcc668ce 100644 --- a/backend/app/services/interfaces/residents_service.py +++ b/backend/app/services/interfaces/residents_service.py @@ -15,7 +15,7 @@ def add_resident(self, id, initial, room_num, date_joined, date_left, building_i :param initial: initial of resident :type initial: string :param room_num: room number which the resident resides in - :type room_num: int + :type room_num: string :param date_joined: the date the resident joined :type date_joined: date :param date_left: the date the resident left, if exists diff --git a/backend/migrations/versions/6ba7859cdf27_add_unique_constraint_to_combined_.py b/backend/migrations/versions/6ba7859cdf27_add_unique_constraint_to_combined_.py new file mode 100644 index 00000000..406bf295 --- /dev/null +++ b/backend/migrations/versions/6ba7859cdf27_add_unique_constraint_to_combined_.py @@ -0,0 +1,43 @@ +"""add unique constraint to combined resident id + +Revision ID: 6ba7859cdf27 +Revises: a1f05c8f324c +Create Date: 2024-01-29 02:25:45.352261 + +""" +from alembic import op +import sqlalchemy as sa +from sqlalchemy.dialects import postgresql + +# revision identifiers, used by Alembic. +revision = '6ba7859cdf27' +down_revision = 'a1f05c8f324c' +branch_labels = None +depends_on = None + + +def upgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.drop_table('entities') + with op.batch_alter_table('residents', schema=None) as batch_op: + batch_op.create_unique_constraint(None, ['initial', 'room_num']) + + # ### end Alembic commands ### + + +def downgrade(): + # ### commands auto generated by Alembic - please adjust! ### + with op.batch_alter_table('residents', schema=None) as batch_op: + batch_op.drop_constraint(None, type_='unique') + + op.create_table('entities', + sa.Column('id', sa.INTEGER(), autoincrement=True, nullable=False), + sa.Column('string_field', sa.VARCHAR(), autoincrement=False, nullable=False), + sa.Column('int_field', sa.INTEGER(), autoincrement=False, nullable=False), + sa.Column('enum_field', postgresql.ENUM('A', 'B', 'C', 'D', name='enum'), autoincrement=False, nullable=False), + sa.Column('string_array_field', postgresql.ARRAY(sa.VARCHAR()), autoincrement=False, nullable=False), + sa.Column('bool_field', sa.BOOLEAN(), autoincrement=False, nullable=False), + sa.Column('file_name', sa.VARCHAR(), autoincrement=False, nullable=True), + sa.PrimaryKeyConstraint('id', name='entities_pkey') + ) + # ### end Alembic commands ### diff --git a/backend/migrations/versions/eff8a5a7fda3_change_resident_room_number_to_be_string.py b/backend/migrations/versions/eff8a5a7fda3_change_resident_room_number_to_be_string.py new file mode 100644 index 00000000..f662f64c --- /dev/null +++ b/backend/migrations/versions/eff8a5a7fda3_change_resident_room_number_to_be_string.py @@ -0,0 +1,38 @@ +"""change resident room number to be string + +Revision ID: eff8a5a7fda3 +Revises: 6ba7859cdf27 +Create Date: 2024-01-31 04:13:02.272243 + +""" +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision = 'eff8a5a7fda3' +down_revision = '6ba7859cdf27' +branch_labels = None +depends_on = None + + +def upgrade(): + # ### commands auto generated by Alembic - please adjust! ### + with op.batch_alter_table('residents', schema=None) as batch_op: + batch_op.alter_column('room_num', + existing_type=sa.INTEGER(), + type_=sa.String(), + existing_nullable=False) + + # ### end Alembic commands ### + + +def downgrade(): + # ### commands auto generated by Alembic - please adjust! ### + with op.batch_alter_table('residents', schema=None) as batch_op: + batch_op.alter_column('room_num', + existing_type=sa.String(), + type_=sa.INTEGER(), + existing_nullable=False) + + # ### end Alembic commands ### diff --git a/db-init/create-multiple-dbs.sh b/db-init/create-multiple-dbs.sh new file mode 100755 index 00000000..18c0f96b --- /dev/null +++ b/db-init/create-multiple-dbs.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +set -e +set -u + +function create_user_and_database() { + local database=$1 + echo " Creating user and database '$database'" + psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" <<-EOSQL + CREATE USER $database; + CREATE DATABASE $database; + GRANT ALL PRIVILEGES ON DATABASE $database TO $database; +EOSQL +} + +if [ -n "$POSTGRES_MULTIPLE_DATABASES" ]; then + echo "Multiple database creation requested: $POSTGRES_MULTIPLE_DATABASES" + for db in $(echo $POSTGRES_MULTIPLE_DATABASES | tr ',' ' '); do + create_user_and_database $db + done + echo "Multiple databases created" +fi \ No newline at end of file diff --git a/frontend/src/components/common/Pagination.tsx b/frontend/src/components/common/Pagination.tsx index b3d1c511..3ae7d8bf 100644 --- a/frontend/src/components/common/Pagination.tsx +++ b/frontend/src/components/common/Pagination.tsx @@ -5,12 +5,11 @@ import { MenuList, MenuItem, Button, - NumberInput, - NumberInputField, IconButton, Flex, Box, Text, + Input } from "@chakra-ui/react"; import { @@ -42,14 +41,23 @@ const Pagination = ({ }: Props): React.ReactElement => { const numPages = Math.ceil(Math.max(1, numRecords) / resultsPerPage); - const handleNumberInputChange = ( - newUserPageNumString: string, - newUserPageNum: number, - ) => { - if (newUserPageNum < 1 || newUserPageNum > numPages) { - return; + const handleNumberInputChange = (e: React.ChangeEvent) => { + const input = e.target.value as string + + if (input === "") { + setUserPageNum(NaN) + return + } + + const numericInput = input.replace(/[^0-9]/g, ''); + + if (numericInput !== "") { + const newUserPageNum = Number(numericInput); + if (newUserPageNum < 1 || newUserPageNum > numPages) { + return; + } + setUserPageNum(newUserPageNum); } - setUserPageNum(newUserPageNum); }; // Only fetch records if a valid page num is present AND the page num has changed @@ -106,19 +114,17 @@ const Pagination = ({ width="210px" > Page - handleBlur()} - > - handleKeyUp(e)} - /> - + fontWeight="700" + color="gray.750" + onKeyUp={(e) => handleKeyUp(e)} + /> of {numPages} { const res = await ResidentAPIClient.createResident({ initial: initials.toUpperCase(), - roomNum: parseInt(roomNumber, 10), + roomNum: roomNumber, dateJoined: convertToString(moveInDate), buildingId, }); diff --git a/frontend/src/components/forms/EditResident.tsx b/frontend/src/components/forms/EditResident.tsx index 21df67ff..2670ac43 100644 --- a/frontend/src/components/forms/EditResident.tsx +++ b/frontend/src/components/forms/EditResident.tsx @@ -50,7 +50,7 @@ const EditResident = ({ getRecords, }: Props): React.ReactElement => { const [initials, setInitials] = useState(""); - const [roomNumber, setRoomNumber] = useState(-1); + const [roomNumber, setRoomNumber] = useState(""); const [moveInDate, setMoveInDate] = useState(new Date()); const [buildingId, setBuildingId] = useState(resident.building.id); const [moveOutDate, setMoveOutDate] = useState(); @@ -102,7 +102,7 @@ const EditResident = ({ const handleRoomNumberChange = (e: React.ChangeEvent) => { const inputValue = e.target.value as string; if (inputValue !== null && /^[0-9]{0,3}$/.test(inputValue)) { - setRoomNumber(parseInt(inputValue, 10)); + setRoomNumber(inputValue); setRoomNumberError(false); } }; diff --git a/frontend/src/components/forms/Signup.tsx b/frontend/src/components/forms/Signup.tsx index b4f49d57..e3fd04ec 100644 --- a/frontend/src/components/forms/Signup.tsx +++ b/frontend/src/components/forms/Signup.tsx @@ -180,6 +180,7 @@ const Signup = ({ setIsLoading(false); } else { const { requiresTwoFa, authUser } = registerResponse; + console.log(requiresTwoFa, authUser) if (requiresTwoFa) { setToggle(!toggle); } else { diff --git a/frontend/src/types/ResidentTypes.ts b/frontend/src/types/ResidentTypes.ts index 77fd5642..54054c7a 100644 --- a/frontend/src/types/ResidentTypes.ts +++ b/frontend/src/types/ResidentTypes.ts @@ -7,7 +7,7 @@ export type Resident = { id: number; residentId: string; initial: string; - roomNum: number; + roomNum: string; dateJoined: string; dateLeft?: string; building: BuildingRecord; diff --git a/seeding/create-log-records.sh b/seeding/create-log-records.sh index ebeeb383..189426e9 100644 --- a/seeding/create-log-records.sh +++ b/seeding/create-log-records.sh @@ -3,37 +3,236 @@ # If you're on Windows, run bash create-log-records.sh -w # Otherwise, run bash create-log-records.sh -# NOTE: -# this script will fail if a user with $EMPLOYEE_ID as an id does not exist -# it will also fail if residents don't exist in the db - # Import common functions SEEDING_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) source $SEEDING_DIR/seed.sh -# Run SQL script in docker container -run_sql_script " +# Import the notes into an array +notes=() +IFS=$'\n' read -d '' -r -a notes < $SEEDING_DIR/notes.txt +number_of_notes=${#notes[@]} + +# Query for resident IDs +residents_query_output=$(run_sql_script "SELECT id from residents;") +resident_ids=() + +# Read each line of the output and extract resident IDs +while IFS= read -r line; do + # Extract resident ID from the line + resident_id=$(echo "$line" | awk '{print $1}') + # Skip if it's not a number + if [[ $resident_id =~ ^[0-9]+$ ]]; then + # Append resident ID to the array + resident_ids+=("$resident_id") + fi +done <<< "$residents_query_output" + +number_of_residents=${#resident_ids[@]} + +# Query for tag ids +tags_query_output=$(run_sql_script "SELECT tag_id from tags;") +tag_ids=() + +# Read each line of the output and extract tag IDs +while IFS= read -r line; do + # Extract tag ID from the line + tag_id=$(echo "$line" | awk '{print $1}') + # Skip if it's not a number + if [[ $tag_id =~ ^[0-9]+$ ]]; then + # Append tag ID to the array + tag_ids+=("$tag_id") + fi +done <<< "$tags_query_output" + +number_of_tags=${#tag_ids[@]} + +# Query for employee ids +employees_query_output=$(run_sql_script "SELECT id from users;") +employee_ids=() + +# Read each line of the output and extract employee IDs +while IFS= read -r line; do + # Extract tag ID from the line + employee_id=$(echo "$line" | awk '{print $1}') + # Skip if it's not a number + if [[ $employee_id =~ ^[0-9]+$ ]]; then + # Append employee ID to the array + employee_ids+=("$employee_id") + fi +done <<< "$employees_query_output" + +number_of_employees=${#employee_ids[@]} + +# ------------------------------------------------------------------------------------------------------------------------ + +# Select employee id to be used +select_employee_id() { + random_index=$((RANDOM % number_of_employees)) + + # Select the random ID using the random index + random_employee_id="${employee_ids[random_index]}" + echo $random_employee_id +} + +# Generate a random date in the range (prev 30 days, next 30 days) +generate_date() { + start_date=$(date -v-30d +%s) + + # Generate a random number of days between 0 and 90 + random_days=$((RANDOM % 91)) + + # Calculate the timestamp for the random date + random_timestamp=$((start_date + (random_days * 86400))) # 86400 secs in day + date -r $random_timestamp +"%Y-%m-%d %H:%M:%S" +} + +# Generate a random True or False value +generate_flagged() { + random_bool=$((RANDOM % 2)) + echo $random_bool +} + +# Select attn to to be used +select_attn_to() { + if (( RANDOM % 2 == 0 )); then + number_of_employees=${#employee_ids[@]} + random_index=$((RANDOM % number_of_employees)) + + # Select the random ID using the random index + random_employee_id="${employee_ids[random_index]}" + echo $random_employee_id + else + echo NULL + fi +} + +# Select a random note from the list +generate_note() { + random_index=$((RANDOM % number_of_notes)) + random_note="${notes[random_index]}" + echo $random_note +} + +# Select a random building ID +select_building_id() { + echo $((RANDOM % 3 + 1)) +} + +# Values to create +log_record_values="" + +# Generate each row of data +for ((i=0; i<$LOG_RECORD_ROWS ; i++)); do + employee_id=$(select_employee_id) + datetime=$(generate_date) + flagged=$(generate_flagged) + attn_to=$(select_attn_to) + note=$(generate_note) + building_id=$(select_building_id) + log_record_values+="('$employee_id', '$datetime', '$flagged', $attn_to, '$note', '$building_id')," +done + +# Remove the trailing comma +log_record_values=${log_record_values%,} + +# Insert log records and get the ids created back +res=$(run_sql_script " INSERT INTO log_records ( employee_id, - resident_id, datetime, flagged, attn_to, note, - tags, building_id ) -SELECT - $EMPLOYEE_ID, - (ARRAY(SELECT generate_series(1, $RESIDENT_ROWS)))[floor(random() * $RESIDENT_ROWS + 1)], - NOW() + (random() * (NOW()+'90 days' - NOW())) + '30 days', - (ARRAY[true,false])[floor(random() * 2 + 1)], - $ATTN_TO_ID, - (ARRAY['Amazing note','This is a note','Bad note','Decent Note','Cool note'])[floor(random() * 5 + 1)], - ARRAY['tag1', 'tag2'], - (ARRAY[1, 2, 3])[floor(random() * 3 + 1)] - -FROM generate_series(1, $LOG_RECORD_ROWS); -" +VALUES $log_record_values +RETURNING log_id; +") + +log_record_ids=() + +# Read each line of the output and extract log record IDs +while IFS= read -r line; do + # Extract log record ID from the line + log_record_id=$(echo "$line" | awk '{print $1}') + # Skip if it's not a number + if [[ $log_record_id =~ ^[0-9]+$ ]]; then + # Append log record ID to the array + log_record_ids+=("$log_record_id") + fi +done <<< "$res" + +# Store tag values needed to insert into junction table +tag_values="" + +for log_record_id in "${log_record_ids[@]}"; do + + # Generate a random list of tag IDs (between 0 and 3) + num_tags=$((RANDOM % 4)) + sub_tag_ids=() + selected_tags=() + + # Randomly select unique tags from the array (keeping track of selected tags so there's no duplicates) + while (( ${#sub_tag_ids[@]} < num_tags )); do + random_index=$((RANDOM % number_of_tags)) + if [[ ! " ${selected_tags[@]} " =~ " $random_index " ]]; then + sub_tag_ids+=("${tag_ids[random_index]}") + selected_tags+=("$random_index") + fi + done + + # Construct SQL INSERT statements for bulk insert + for sub_tag_id in "${sub_tag_ids[@]}"; do + tag_values+="('$log_record_id', '$sub_tag_id')," + done +done + +# Remove the trailing comma +tag_values=${tag_values%,} + +# Insert into junction table if there's any generated tags +if [ -n "$tag_values" ]; then + run_sql_script " + INSERT INTO log_record_tag ( + log_record_id, + tag_id + ) + VALUES $tag_values;" +fi + +# Store resident values needed to insert into junction table +resident_values="" + +for log_record_id in "${log_record_ids[@]}"; do + + # Generate a random list of resident IDs (between 1 and 3) + num_residents=$((RANDOM % 3 + 1)) + sub_resident_ids=() + selected_residents=() + + # Randomly select unique residents from the array (keeping track of selected residents so there's no duplicates) + while (( ${#sub_resident_ids[@]} < num_residents )); do + random_index=$((RANDOM % number_of_residents)) + if [[ ! " ${selected_residents[@]} " =~ " $random_index " ]]; then + sub_resident_ids+=("${resident_ids[random_index]}") + selected_residents+=("$random_index") + fi + done + + # Construct SQL INSERT statements for bulk insert + for sub_resident_id in "${sub_resident_ids[@]}"; do + resident_values+="('$log_record_id', '$sub_resident_id')," + done +done + +# Remove the trailing comma +resident_values=${resident_values%,} + +run_sql_script " +INSERT INTO log_record_residents ( + log_record_id, + resident_id +) +VALUES $resident_values;" echo "Log Record seeding complete" diff --git a/seeding/create-residents.sh b/seeding/create-residents.sh index fae01c8a..8e9234f3 100644 --- a/seeding/create-residents.sh +++ b/seeding/create-residents.sh @@ -7,25 +7,70 @@ SEEDING_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) source $SEEDING_DIR/seed.sh -# Run SQL script in docker container -run_sql_script " -DELETE FROM residents; +# Generate random initials +generate_initials() { + letters=({A..Z}) + echo "${letters[RANDOM % 26]}${letters[RANDOM % 26]}" +} + +# Generate random room number in the range [000, 999] +generate_room_num() { + printf "%03d\n" $((RANDOM % 1000)) +} + +# Generate a random date in the range (prev 30 days, next 30 days) +generate_date() { + start_date=$(date -v-30d +%s) + + # Generate a random number of days between 0 and 90 + random_days=$((RANDOM % 91)) + + # Calculate the timestamp for the random date + random_timestamp=$((start_date + (random_days * 86400))) # 86400 secs in day + date -r $random_timestamp +"%Y-%m-%d" +} + +# Select a random building ID +select_building_id() { + echo $((RANDOM % 3 + 1)) +} + +# Values to create +values="" -ALTER SEQUENCE residents_id_seq RESTART WITH 1; +# Generate each row of data +for ((i=0; i<$RESIDENT_ROWS ; i++)); do + initials=$(generate_initials) + room_num=$(generate_room_num) + date_joined=$(generate_date) + # Randomly set date left to be 15 days after date joined + date_left=NULL + if (( RANDOM % 2 == 0 )); then + date_joined_timestamp=$(date -j -f "%Y-%m-%d" "$date_joined" "+%s") + date_left_timestamp=$((date_joined_timestamp + 15 * 86400)) + date_left=$(date -r "$date_left_timestamp" +"%Y-%m-%d") + date_left="'$date_left'" # Surround with single quotes for SQL insertion + fi + + building_id=$(select_building_id) + values+="('$initials', '$room_num', '$date_joined', $date_left, $building_id)," +done + +# Remove the trailing comma +values=${values%,} + +# Run SQL script in docker container +run_sql_script " INSERT INTO residents ( initial, room_num, date_joined, + date_left, building_id ) -SELECT - chr(65 + floor(random() * 26)::integer) || chr(65 + floor(random() * 26)::integer), - floor(random() * 900 + 100)::integer, - NOW() + (random() * (NOW()+'90 days' - NOW())) + '30 days', - (ARRAY[1, 2, 3])[floor(random() * 3 + 1)::integer] - -FROM generate_series(1, $RESIDENT_ROWS); +VALUES $values +ON CONFLICT (initial, room_num) DO NOTHING; " echo "Resident seeding complete" diff --git a/seeding/create-tags.sh b/seeding/create-tags.sh new file mode 100644 index 00000000..32d6f07c --- /dev/null +++ b/seeding/create-tags.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +# If you're on Windows, run bash create-tags.sh -w +# Otherwise, run bash create-tags.sh + +# Import common functions +SEEDING_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) +source $SEEDING_DIR/seed.sh + +# Construct tag name array +data=() +for ((i=1; i <= $TAG_ROWS; i++)); do + name="tag_$i" + data+=("('$name')") +done + +# Join with commas +values=$(IFS=,; echo "${data[*]}") + +# Run SQL script in docker container +run_sql_script " +INSERT INTO tags ( + name +) +VALUES $values +ON CONFLICT (name) DO NOTHING; +" + +echo "Tags seeding complete" \ No newline at end of file diff --git a/seeding/notes.txt b/seeding/notes.txt new file mode 100644 index 00000000..890f3316 --- /dev/null +++ b/seeding/notes.txt @@ -0,0 +1,100 @@ +He wandered down the stairs and into the basement. The damp, musty smell of unuse hung in the air. A single, small window let in a glimmer of light, but this simply made the shadows in the basement deeper. He inhaled deeply and looked around at a mess that had been accumulating for over 25 years. He was positive that this was the place he wanted to live. +Barbara had been waiting at the table for twenty minutes. it had been twenty long and excruciating minutes. David had promised that he would be on time today. He never was, but he had promised this one time. She had made him repeat the promise multiple times over the last week until she''d believed his promise. Now she was paying the price. +Mary had to make a decision and she knew that whatever decision she made, it would upset someone. It seemed like such a silly reason for people to get upset but she knew the minute that she began to consider doing it that there was no way everyone in her life would be pleased with what she ultimately decided to do. It was simply a question of who she would rather displease most. While this had always been her parents, and especially her mom, in the past that she tried to keep from upsetting, she decided that this time the person she was going to please the most with her decision was herself. +Was it enough? That was the question he kept asking himself. Was being satisfied enough? He looked around him at everyone yearning to just be satisfied in their daily life and he had reached that goal. He knew that he was satisfied and he also knew it wasn''t going to be enough. +Dragons don''t exist they said. They are the stuff of legend and people''s imagination. Greg would have agreed with this assessment without a second thought 24 hours ago. But now that there was a dragon staring directly into his eyes, he questioned everything that he had been told. +Betty decided to write a short story and she was sure it was going to be amazing. She had already written it in her head and each time she thought about it she grinned from ear to ear knowing how wonderful it would be. She could imagine the accolades coming in and the praise she would receive for creating such a wonderful piece. She was therefore extremely frustrated when she actually sat down to write the short story and the story that was so beautiful inside her head refused to come out that way on paper. +"Explain to me again why I shouldn''t cheat?" he asked. "All the others do and nobody ever gets punished for doing so. I should go about being happy losing to cheaters because I know that I don''t? That''s what you''re telling me?" +He stared out the window at the snowy field. He''d been stuck in the house for close to a month and his only view of the outside world was through the window. There wasn''t much to see. It was mostly just the field with an occasional bird or small animal who ventured into the field. As he continued to stare out the window, he wondered how much longer he''d be shackled to the steel bar inside the house. +It''s not his fault. I know you''re going to want to, but you can''t blame him. He really has no idea how it happened. I kept trying to come up with excuses I could say to mom that would keep her calm when she found out what happened, but the more I tried, the more I could see none of them would work. He was going to get her wrath and there was nothing I could say to prevent it. +He lifted the bottle to his lips and took a sip of the drink. He had tasted this before, but he couldn''t quite remember the time and place it had happened. He desperately searched his mind trying to locate and remember where he had tasted this when the bicycle ran over his foot. +The headphones were on. They had been utilized on purpose. She could hear her mom yelling in the background, but couldn''t make out exactly what the yelling was about. That was exactly why she had put them on. She knew her mom would enter her room at any minute, and she could pretend that she hadn''t heard any of the previous yelling. +Sometimes it''s just better not to be seen. That''s how Harry had always lived his life. He prided himself as being the fly on the wall and the fae that blended into the crowd. That''s why he was so shocked that she noticed him. +"It''s never good to give them details," Janice told her sister. "Always be a little vague and keep them guessing." Her sister listened intently and nodded in agreement. She didn''t fully understand what her sister was saying but that didn''t matter. She loved her so much that she would have agreed to whatever came out of her mouth. +She was infatuated with color. She didn''t have a favorite color per se, but she did have a fondness for teals and sea greens. You could see it in the clothes she wore that color was an important part of her overall style. She took great pride that color flowed from her and that color was always all around her. That is why, she explained to her date sitting across the table, that she could never have a serious relationship with him due to the fact that he was colorblind. +It had been her dream for years but Dana had failed to take any action toward making it come true. There had always been a good excuse to delay or prioritize another project. As she woke, she realized she was once again at a crossroads. Would it be another excuse or would she finally find the courage to pursue her dream? Dana rose and took her first step. +Rhonda prided herself on always taking the path less traveled. She''d decided to do this at an early age and had continued to do so throughout her entire life. It was a point of pride and she would explain to anyone who would listen that doing so was something that she''d made great efforts to always do. She''d never questioned this decision until her five-year-old niece asked her, "So, is this why your life has been so difficult?" and Rhonda didn''t have an answer for her. +She was in a hurry. Not the standard hurry when you''re in a rush to get someplace, but a frantic hurry. The type of hurry where a few seconds could mean life or death. She raced down the road ignoring speed limits and weaving between cars. She was only a few minutes away when traffic came to a dead standstill on the road ahead. +Wandering down the path to the pond had become a daily routine. Even when the weather wasn''t cooperating like today with the wind and rain, Jerry still took the morning stroll down the path until he reached the pond. Although there didn''t seem to be a particular reason Jerry did this to anyone looking in from the outside, those who knew him well knew exactly what was going on. It could all be traced back to a specific incident that happened exactly 5 years previously. +What were the chances? It would have to be a lot more than 100 to 1. It was likely even more than 1,000 to 1. The more he thought about it, the odds of it happening had to be more than 10,000 to 1 and even 100,000 to 1. People often threw around the chances of something happening as being 1,000,000 to 1 as an exaggeration of an unlikely event, but he could see that they may actually be accurate in this situation. Whatever the odds of it happening, he knew they were big. What he didn''t know was whether this happening was lucky or unlucky. +He sat across from her trying to imagine it was the first time. It wasn''t. Had it been a hundred? It quite possibly could have been. Two hundred? Probably not. His mind wandered until he caught himself and again tried to imagine it was the first time. +Have you ever wondered about toes? Why 10 toes and not 12. Why are some bigger than others? Some people can use their toes to pick up things while others can barely move them on command. Some toes are nice to look at while others are definitely not something you want to look at. Toes can be stubbed and make us scream. Toes help us balance and walk. 10 toes are just something to ponder. +It was a good idea. At least, they all thought it was a good idea at the time. Hindsight would reveal that in reality, it was an unbelievably terrible idea, but it would take another week for them to understand that. Right now, at this very moment. they all agreed that it was the perfect course of action for the current situation. +She had been told time and time again that the most important steps were the first and the last. It was something that she carried within her in everything she did, but then he showed up and disrupted everything. He told her that she had it wrong. The first step wasn''t the most important. The last step wasn''t the most important. It was the next step that was the most important. +The robot clicked disapprovingly, gurgled briefly inside its cubical interior and extruded a pony glass of brownish liquid. "Sir, you will undoubtedly end up in a drunkard''s grave, dead of hepatic cirrhosis," it informed me virtuously as it returned my ID card. I glared as I pushed the glass across the table. +It had been a simple realization that had changed Debra''s life perspective. It was really so simple that she was embarrassed that she had lived the previous five years with the way she measured her worth. Now that she saw what she had been doing, she could see how sad it was. That made her all the more relieved she had made the change. The number of hearts her Instagram posts received wasn''t any longer the indication of her own self-worth. +She didn''t like the food. She never did. She made the usual complaints and started the tantrum he knew was coming. But this time was different. Instead of trying to placate her and her unreasonable demands, he just stared at her and watched her meltdown without saying a word. +Green vines attached to the trunk of the tree had wound themselves toward the top of the canopy. Ants used the vine as their private highway, avoiding all the creases and crags of the bark, to freely move at top speed from top to bottom or bottom to top depending on their current chore. At least this was the way it was supposed to be. Something had damaged the vine overnight halfway up the tree leaving a gap in the once pristine ant highway. +What have you noticed today? I noticed that if you outline the eyes, nose, and mouth on your face with your finger, you make an "I" which makes perfect sense, but is something I never noticed before. What have you noticed today? +They rushed out the door, grabbing anything and everything they could think of they might need. There was no time to double-check to make sure they weren''t leaving something important behind. Everything was thrown into the car and they sped off. Thirty minutes later they were safe and that was when it dawned on them that they had forgotten the most important thing of all. +Dave found joy in the daily routine of life. He awoke at the same time, ate the same breakfast and drove the same commute. He worked at a job that never seemed to change and he got home at 6 pm sharp every night. It was who he had been for the last ten years and he had no idea that was all about to change. +There were two things that were important to Tracey. The first was her dog. Anyone that had ever met Tracey knew how much she loved her dog. Most would say that she treated it as her child. The dog went everywhere with her and it had been her best friend for the past five years. The second thing that was important to Tracey, however, would be a lot more surprising to most people. +He sat staring at the person in the train stopped at the station going in the opposite direction. She sat staring ahead, never noticing that she was being watched. Both trains began to move and he knew that in another timeline or in another universe, they had been happy together. +They had always called it the green river. It made sense. The river was green. The river likely had a different official name, but to everyone in town, it was and had always been the green river. So it was with great surprise that on this day the green river was a fluorescent pink. +The trees, therefore, must be such old and primitive techniques that they thought nothing of them, deeming them so inconsequential that even savages like us would know of them and not be suspicious. At that, they probably didn''t have too much time after they detected us orbiting and intending to land. And if that were true, there could be only one place where their civilization was hidden. +There was nothing else to do. The deed had already been done and there was no going back. It now had been become a question of how they were going to be able to get out of this situation and escape. +Twenty seconds were all that was left and Richard could hear each one tick by. Fifteen seconds now remained and the panic began to fully set in. Ten seconds and he wasn''t sure he had enough time. Five seconds, four, three, two, one... +It really shouldn''t have mattered to Betty. That''s what she kept trying to convince herself even if she knew it mattered to Betty more than practically anything else. Why was she trying to convince herself otherwise? As she stepped forward to knock on Betty''s door, she still didn''t have a convincing answer to this question that she''d been asking herself for more than two years now. +Samantha wanted to be famous. The problem was that she had never considered all the downsides to actually being famous. Had she taken the time to objectively consider these downsides, she would have never agreed to publically sing that first song. +To the two friends, the treehouse was much more than a treehouse. It was a sanctuary away from the other kids where they could be themselves without being teased or bullied. It was their secret fortress hidden high in the branches of a huge oak that only they knew existed. At least that is what they thought. They were more than a little annoyed when their two younger sisters decided to turn the treehouse into a princess castle by painting the inside pink and putting glitter everywhere. +They say you only come to peace with yourself when you know yourself better than those around you. Derick knew nothing about this. He thought he had found peace but this was an illusion as he was about to find out with an unexpected occurrence that he actually knew nothing about himself. +There was no ring on his finger. That was a good sign although far from proof that he was available. Still, it was much better than if he had been wearing a wedding ring on his hand. She glanced at his hand a bit more intently to see if there were any tan lines where a ring may have been, and he''s simply taken it off. She couldn''t detect any which was also a good sign and a relief. The next step would be to get access to his wallet to see if there were any family photos in it. +It was their first date and she had been looking forward to it the entire week. She had her eyes on him for months, and it had taken a convoluted scheme with several friends to make it happen, but he''d finally taken the hint and asked her out. After all the time and effort she''d invested into it, she never thought that it would be anything but wonderful. It goes without saying that things didn''t work out quite as she expected. +She looked at her student wondering if she could ever get through. "You need to learn to think for yourself," she wanted to tell him. "Your friends are holding you back and bringing you down." But she didn''t because she knew his friends were all that he had and even if that meant a life of misery, he would never give them up. +It was just a burger. Why couldn''t she understand that? She knew he''d completely changed his life around her eating habits, so why couldn''t she give him a break this one time? She wasn''t even supposed to have found out. Yes, he had promised her and yes, he had broken that promise, but still in his mind, all it had been was just a burger. +She had a terrible habit o comparing her life to others. She realized that their life experiences were completely different than her own and that she saw only what they wanted her to see, but that didn''t matter. She still compared herself and yearned for what she thought they had and she didn''t. +Should he write it down? That was the question running through his mind. He couldn''t believe what had just happened and he knew nobody else would believe him as well. Even if he documented what had happened by writing it down, he still didn''t believe anyone would still believe it. So the question remained. Was it be worth it to actually write it down? +He swung back the fishing pole and cast the line which ell 25 feet away into the river. The lure landed in the perfect spot and he was sure he would soon get a bite. He never expected that the bite would come from behind in the form of a bear. +He was after the truth. At least, that''s what he told himself. He believed it, but any rational person on the outside could see he was lying to himself. It was apparent he was really only after his own truth that he''d already decided and was after this truth because the facts didn''t line up with the truth he wanted. So he continued to tell everyone he was after the truth oblivious to the real truth sitting right in front of him. +You''re going to make a choice today that will have a direct impact on where you are five years from now. The truth is, you''ll make choice like that every day of your life. The problem is that on most days, you won''t know the choice you make will have such a huge impact on your life in the future. So if you want to end up in a certain place in the future, you need to be careful of the choices you make today. +There was something special about this little creature. Donna couldn''t quite pinpoint what it was, but she knew with all her heart that it was true. It wasn''t a matter of if she was going to try and save it, but a matter of how she was going to save it. She went back to the car to get a blanket and when she returned the creature was gone. +They had always called it the green river. It made sense. The river was green. The river likely had a different official name, but to everyone in town, it was and had always been the green river. So it was with great surprise that on this day the green river was a fluorescent pink. +She was in a hurry. Not the standard hurry when you''re in a rush to get someplace, but a frantic hurry. The type of hurry where a few seconds could mean life or death. She raced down the road ignoring speed limits and weaving between cars. She was only a few minutes away when traffic came to a dead standstill on the road ahead. +You can decide what you want to do in life, but I suggest doing something that creates. Something that leaves a tangible thing once you''re done. That way even after you''re gone, you will still live on in the things you created. +As she sat watching the world go by, something caught her eye. It wasn''t so much its color or shape, but the way it was moving. She squinted to see if she could better understand what it was and where it was going, but it didn''t help. As she continued to stare into the distance, she didn''t understand why this uneasiness was building inside her body. She felt like she should get up and run. If only she could make out what it was. At that moment, she comprehended what it was and where it was heading, and she knew her life would never be the same. +Pink ponies and purple giraffes roamed the field. Cotton candy grew from the ground as a chocolate river meandered off to the side. What looked like stones in the pasture were actually rock candy. Everything in her dream seemed to be perfect except for the fact that she had no mouth. +She didn''t understand how changed worked. When she looked at today compared to yesterday, there was nothing that she could see that was different. Yet, when she looked at today compared to last year, she couldn''t see how anything was ever the same. +Wandering down the path to the pond had become a daily routine. Even when the weather wasn''t cooperating like today with the wind and rain, Jerry still took the morning stroll down the path until he reached the pond. Although there didn''t seem to be a particular reason Jerry did this to anyone looking in from the outside, those who knew him well knew exactly what was going on. It could all be traced back to a specific incident that happened exactly 5 years previously. +It was that terrifying feeling you have as you tightly hold the covers over you with the knowledge that there is something hiding under your bed. You want to look, but you don''t at the same time. You''re frozen with fear and unable to act. That''s where she found herself and she didn''t know what to do next +She reached her goal, exhausted. Even more chilling to her was that the euphoria that she thought she''d feel upon reaching it wasn''t there. Something wasn''t right. Was this the only feeling she''d have for over five years of hard work? +Here''s the thing. She doesn''t have anything to prove, but she is going to anyway. That''s just her character. She knows she doesn''t have to, but she still will just to show you that she can. Doubt her more and she''ll prove she can again. We all already know this and you will too. +"What is the best way to get what you want?" she asked. He looked down at the ground knowing that she wouldn''t like his answer. He hesitated, knowing that the truth would only hurt. How was he going to tell her that the best way for him to get what he wanted was to leave her? +Sometimes it just doesn''t make sense. The man walking down the street in a banana suit. The llama standing in the middle of the road. The fairies dancing in front of the car window. The fact that all of this was actually happening and wasn''t a dream. +She looked at her little girl who was about to become a teen. She tried to think back to when the girl had been younger but failed to pinpoint the exact moment when she had become a little too big to pick up and carry. It hit her all at once. She was no longer a little girl and she stood there speechless with fear, sadness, and pride all running through her at the same time. +Don''t forget that gifts often come with costs that go beyond their purchase price. When you purchase a child the latest smartphone, you''re also committing to a monthly phone bill. When you purchase the latest gaming system, you''re likely not going to be satisfied with the games that come with it for long and want to purchase new titles to play. When you buy gifts it''s important to remember that some come with additional costs down the road that can be much more expensive than the initial gift itself. +What have you noticed today? I noticed that if you outline the eyes, nose, and mouth on your face with your finger, you make an "I" which makes perfect sense, but is something I never noticed before. What have you noticed today? +They needed to find a place to eat. The kids were beginning to get grumpy in the back seat and if they didn''t find them food soon, it was just a matter of time before they were faced with a complete meltdown. Even knowing this, the solution wasn''t easy. Everyone in the car had a different opinion on where the best place to eat would be with nobody agreeing with the suggestions of the others. It seemed to be an impossible no-win situation where not everyone would be happy no matter where they decided to eat which in itself would lead to a meltdown. Yet a decision needed to be made and it needed to be made quickly. +There was something beautiful in his hate. It wasn''t the hate itself as it was a disgusting display of racism and intolerance. It was what propelled the hate and the fact that although he had this hate, he didn''t understand where it came from. It was at that moment that she realized that there was hope in changing him. +There were only two ways to get out of this mess if they all worked together. The problem was that neither was all that appealing. One would likely cause everyone a huge amount of physical pain while the other would likely end up with everyone in jail. In Sam''s mind, there was only one thing to do. He threw everyone else under the bus and he secretly sprinted away leaving the others to take the fall without him. +They say you only come to peace with yourself when you know yourself better than those around you. Derick knew nothing about this. He thought he had found peace but this was an illusion as he was about to find out with an unexpected occurrence that he actually knew nothing about himself. +It''s an unfortunate reality that we don''t teach people how to make money (beyond getting a 9 to 5 job) as part of our education system. The truth is there are a lot of different, legitimate ways to make money. That doesn''t mean they are easy and that you won''t have to work hard to succeed, but it does mean that if you''re willing to open your mind a bit you don''t have to be stuck in an office from 9 to 5 for the next fifty years o your life. +There are different types of secrets. She had held onto plenty of them during her life, but this one was different. She found herself holding onto the worst type. It was the type of secret that could gnaw away at your insides if you didn''t tell someone about it, but it could end up getting you killed if you did. +It all started with the computer. Had he known what was to follow, he would have never logged on that day. But the truth was there was no way to know what was about to happen. So Dave pressed the start button, the computer booted up, the screen came alive, and everything Dave knew to be true no longer was. +Do you really listen when you are talking with someone? I have a friend who listens in an unforgiving way. She actually takes every word you say as being something important and when you have a friend that listens like that, words take on a whole new meaning. +Twenty-five years Dana had been waiting. She tried to be patient during that time but she hadn''t always managed to be as patient as she''d like. But today the opportunity had finally come. The thing she always imagined would make her the happiest person in the world was about to happen. She didn''t know why at this specific time she all of a sudden felt sick inside. +Eating raw fish didn''t sound like a good idea. "It''s a delicacy in Japan," didn''t seem to make it any more appetizing. Raw fish is raw fish, delicacy or not. +Dave watched as the forest burned up on the hill, only a few miles from her house. The car had been hastily packed and Marta was inside trying to round up the last of the pets. Dave went through his mental list of the most important papers and documents that they couldn''t leave behind. He scolded himself for not having prepared these better in advance and hoped that he had remembered everything that was needed. He continued to wait for Marta to appear with the pets, but she still was nowhere to be seen. +One can cook on and with an open fire. These are some of the ways to cook with fire outside. Cooking meat using a spit is a great way to evenly cook meat. In order to keep meat from burning, it''s best to slowly rotate it. Hot stones can be used to toast bread. Coals are hot and can bring things to a boil quickly. If one is very adventurous, one can make a hole in the ground, fill it with coals and place foil-covered meat, veggies, and potatoes into the coals, and cover all of it with dirt. In a short period of time, the food will be baked. Campfire cooking can be done in many ways. +The light blinded him. It was dark and he thought he was the only one in the area, but the light shining in his eyes proved him wrong. It came from about 100 feet away and was shining so directly into his eyes he couldn''t make out anything about the person holding the light. There was only one thing to do in this situation. He reached into his pocket and pulled out a flashlight of his own that was much stronger than the one currently blinding him. He turned it on and pointed it into the stranger''s eyes. +It wasn''t that he hated her. It was simply that he didn''t like her much. It was difficult for him to explain this to her, and even more difficult for her to truly understand. She was in love and wanted him to feel the same way. He didn''t, and no matter how he tried to explain to her she refused to listen or to understand. +He wondered if he should disclose the truth to his friends. It would be a risky move. Yes, the truth would make things a lot easier if they all stayed on the same page, but the truth might fracture the group leaving everything in even more of a mess than it was not telling the truth. It was time to decide which way to go. +Brock would have never dared to do it on his own he thought to himself. That is why Kenneth and he had become such good friends. Kenneth forced Brock out of his comfort zone and made him try new things he''d never imagine doing otherwise. Up to this point, this had been a good thing. It had expanded Brock''s experiences and given him a new appreciation for life. Now that both of them were in the back of a police car, all Brock could think was that he would have never dared do it except for the influence of Kenneth. +The spot was perfect for camouflage. At least that''s what she thought when she picked the spot. She couldn''t imagine that anyone would ever be able to see her in these surroundings. So there she sat, confident that she was hidden from the world and safe from danger. Unfortunately, she had not anticipated that others may be looking upon her from other angles, and now they were stealthily descending toward her hiding spot. +The paper was blank. It shouldn''t have been. There should have been writing on the paper, at least a paragraph if not more. The fact that the writing wasn''t there was frustrating. Actually, it was even more than frustrating. It was downright distressing. +There was a reason for her shyness. Everyone assumed it had always been there but she knew better. She knew the exact moment that the shyness began. It had been that fateful moment at the lake. There are just some events that do that to you. +"Explain to me again why I shouldn''t cheat?" he asked. "All the others do and nobody ever gets punished for doing so. I should go about being happy losing to cheaters because I know that I don''t? That''s what you''re telling me?" +He sat staring at the person in the train stopped at the station going in the opposite direction. She sat staring ahead, never noticing that she was being watched. Both trains began to move and he knew that in another timeline or in another universe, they had been happy together. +It was always the Monday mornings. It never seemed to happen on Tuesday morning, Wednesday morning, or any other morning during the week. But it happened every Monday morning like clockwork. He mentally prepared himself to once again deal with what was about to happen, but this time he also placed a knife in his pocket just in case. +The water rush down the wash and into the slot canyon below. Two hikers had started the day to sunny weather without a cloud in the sky, but they hadn''t thought to check the weather north of the canyon. Huge thunderstorms had brought a deluge o rain and produced flash floods heading their way. The two hikers had no idea what was coming. +The bridge spanning a 100-foot gully stood in front of him as the last obstacle blocking him from reaching his destination. While people may have called it a "bridge", the reality was it was nothing more than splintered wooden planks held together by rotting ropes. It was questionable whether it would hold the weight of a child, let alone the weight of a grown man. The problem was there was no other way across the gully, and this played into his calculations of whether or not it was worth the risk of trying to cross it. +There was a time and a place for Stephanie to use her magic. The problem was that she had a difficult time determining this. She wished she could simply use it when the desire hit and there wouldn''t be any unforeseen consequences. Unfortunately, that''s not how it worked and the consequences could be devastating if she accidentally used her magic at the wrong time. +It went through such rapid contortions that the little bear was forced to change his hold on it so many times he became confused in the darkness, and could not, for the life of him, tell whether he held the sheep right side up, or upside down. But that point was decided for him a moment later by the animal itself, who, with a sudden twist, jabbed its horns so hard into his lowest ribs that he gave a grunt of anger and disgust. +Was it a whisper or was it the wind? He wasn''t quite sure. He thought he heard a voice but at this moment all he could hear was the wind rustling the leaves of the trees all around him. He stopped and listened more intently to see if he could hear the voice again. Nothing but the wind rustling the leaves could be heard. He was about to continue his walk when he felt a hand on his shoulder, and he quickly turned to see who it was. There was nobody there, but he heard the voice again. +She closed her eyes and then opened them again. What she was seeing just didn''t make sense. She shook her head seeing if that would help. It didn''t. Although it seemed beyond reality, there was no denying she was witnessing a large formation of alien spaceships filling the sky. +The trees, therefore, must be such old and primitive techniques that they thought nothing of them, deeming them so inconsequential that even savages like us would know of them and not be suspicious. At that, they probably didn''t have too much time after they detected us orbiting and intending to land. And if that were true, there could be only one place where their civilization was hidden. +She tried not to judge him. His ratty clothes and unkempt hair made him look homeless. Was he really the next Einstein as she had been told? On the off chance it was true, she continued to try not to judge him. +He had disappointed himself more than anyone else. That wasn''t to say that he hadn''t disappointed others. The fact was that he had disappointed a lot of people who were close to him. The fact that they were disappointed in him was something that made him even more disappointed in himself. Yet here he was, about to do the exact same things that had caused all the disappointment in the first place because he didn''t know what else to do. +There was a time when this wouldn''t have bothered her. The fact that it did actually bother her bothered her even more. What had changed in her life that such a small thing could annoy her so much for the entire day? She knew it was ridiculous that she even took notice of it, yet she was still obsessing over it as she tried to fall asleep. +He couldn''t move. His head throbbed and spun. He couldn''t decide if it was the flu or the drinking last night. It was probably a combination of both. +He dropped the ball. While most people would think that this was a metaphor of some type, in Joe''s case it was absolutely literal. He had hopes of reaching the Major League and that dream was now it great jeopardy. All because he had dropped the ball. +She sat in the darkened room waiting. It was now a standoff. He had the power to put her in the room, but not the power to make her repent. It wasn''t fair and no matter how long she had to endure the darkness, she wouldn''t change her attitude. At three years old, Sandy''s stubborn personality had already bloomed into full view. From 9b0ed8352503fa079eea4b6fca7bcfba32a5e361 Mon Sep 17 00:00:00 2001 From: Connor Bechthold Date: Wed, 31 Jan 2024 01:33:52 -0500 Subject: [PATCH 2/2] run ze linter --- backend/app/models/residents.py | 2 +- ...df27_add_unique_constraint_to_combined_.py | 45 ++++++++++++------- ...hange_resident_room_number_to_be_string.py | 28 +++++++----- frontend/src/components/common/Pagination.tsx | 10 ++--- frontend/src/components/forms/Signup.tsx | 1 - 5 files changed, 50 insertions(+), 36 deletions(-) diff --git a/backend/app/models/residents.py b/backend/app/models/residents.py index d435d647..5358affd 100644 --- a/backend/app/models/residents.py +++ b/backend/app/models/residents.py @@ -28,7 +28,7 @@ class Residents(db.Model): db.CheckConstraint( "date_left IS NULL OR date_left > date_joined", name="check_date_left_valid" ), - db.UniqueConstraint('initial', 'room_num'), + db.UniqueConstraint("initial", "room_num"), ) def to_dict(self, include_relationships=False): diff --git a/backend/migrations/versions/6ba7859cdf27_add_unique_constraint_to_combined_.py b/backend/migrations/versions/6ba7859cdf27_add_unique_constraint_to_combined_.py index 406bf295..5a68f69f 100644 --- a/backend/migrations/versions/6ba7859cdf27_add_unique_constraint_to_combined_.py +++ b/backend/migrations/versions/6ba7859cdf27_add_unique_constraint_to_combined_.py @@ -10,34 +10,45 @@ from sqlalchemy.dialects import postgresql # revision identifiers, used by Alembic. -revision = '6ba7859cdf27' -down_revision = 'a1f05c8f324c' +revision = "6ba7859cdf27" +down_revision = "a1f05c8f324c" branch_labels = None depends_on = None def upgrade(): # ### commands auto generated by Alembic - please adjust! ### - op.drop_table('entities') - with op.batch_alter_table('residents', schema=None) as batch_op: - batch_op.create_unique_constraint(None, ['initial', 'room_num']) + op.drop_table("entities") + with op.batch_alter_table("residents", schema=None) as batch_op: + batch_op.create_unique_constraint(None, ["initial", "room_num"]) # ### end Alembic commands ### def downgrade(): # ### commands auto generated by Alembic - please adjust! ### - with op.batch_alter_table('residents', schema=None) as batch_op: - batch_op.drop_constraint(None, type_='unique') - - op.create_table('entities', - sa.Column('id', sa.INTEGER(), autoincrement=True, nullable=False), - sa.Column('string_field', sa.VARCHAR(), autoincrement=False, nullable=False), - sa.Column('int_field', sa.INTEGER(), autoincrement=False, nullable=False), - sa.Column('enum_field', postgresql.ENUM('A', 'B', 'C', 'D', name='enum'), autoincrement=False, nullable=False), - sa.Column('string_array_field', postgresql.ARRAY(sa.VARCHAR()), autoincrement=False, nullable=False), - sa.Column('bool_field', sa.BOOLEAN(), autoincrement=False, nullable=False), - sa.Column('file_name', sa.VARCHAR(), autoincrement=False, nullable=True), - sa.PrimaryKeyConstraint('id', name='entities_pkey') + with op.batch_alter_table("residents", schema=None) as batch_op: + batch_op.drop_constraint(None, type_="unique") + + op.create_table( + "entities", + sa.Column("id", sa.INTEGER(), autoincrement=True, nullable=False), + sa.Column("string_field", sa.VARCHAR(), autoincrement=False, nullable=False), + sa.Column("int_field", sa.INTEGER(), autoincrement=False, nullable=False), + sa.Column( + "enum_field", + postgresql.ENUM("A", "B", "C", "D", name="enum"), + autoincrement=False, + nullable=False, + ), + sa.Column( + "string_array_field", + postgresql.ARRAY(sa.VARCHAR()), + autoincrement=False, + nullable=False, + ), + sa.Column("bool_field", sa.BOOLEAN(), autoincrement=False, nullable=False), + sa.Column("file_name", sa.VARCHAR(), autoincrement=False, nullable=True), + sa.PrimaryKeyConstraint("id", name="entities_pkey"), ) # ### end Alembic commands ### diff --git a/backend/migrations/versions/eff8a5a7fda3_change_resident_room_number_to_be_string.py b/backend/migrations/versions/eff8a5a7fda3_change_resident_room_number_to_be_string.py index f662f64c..b68a6352 100644 --- a/backend/migrations/versions/eff8a5a7fda3_change_resident_room_number_to_be_string.py +++ b/backend/migrations/versions/eff8a5a7fda3_change_resident_room_number_to_be_string.py @@ -10,29 +10,33 @@ # revision identifiers, used by Alembic. -revision = 'eff8a5a7fda3' -down_revision = '6ba7859cdf27' +revision = "eff8a5a7fda3" +down_revision = "6ba7859cdf27" branch_labels = None depends_on = None def upgrade(): # ### commands auto generated by Alembic - please adjust! ### - with op.batch_alter_table('residents', schema=None) as batch_op: - batch_op.alter_column('room_num', - existing_type=sa.INTEGER(), - type_=sa.String(), - existing_nullable=False) + with op.batch_alter_table("residents", schema=None) as batch_op: + batch_op.alter_column( + "room_num", + existing_type=sa.INTEGER(), + type_=sa.String(), + existing_nullable=False, + ) # ### end Alembic commands ### def downgrade(): # ### commands auto generated by Alembic - please adjust! ### - with op.batch_alter_table('residents', schema=None) as batch_op: - batch_op.alter_column('room_num', - existing_type=sa.String(), - type_=sa.INTEGER(), - existing_nullable=False) + with op.batch_alter_table("residents", schema=None) as batch_op: + batch_op.alter_column( + "room_num", + existing_type=sa.String(), + type_=sa.INTEGER(), + existing_nullable=False, + ) # ### end Alembic commands ### diff --git a/frontend/src/components/common/Pagination.tsx b/frontend/src/components/common/Pagination.tsx index 3ae7d8bf..73a4d0a1 100644 --- a/frontend/src/components/common/Pagination.tsx +++ b/frontend/src/components/common/Pagination.tsx @@ -9,7 +9,7 @@ import { Flex, Box, Text, - Input + Input, } from "@chakra-ui/react"; import { @@ -42,14 +42,14 @@ const Pagination = ({ const numPages = Math.ceil(Math.max(1, numRecords) / resultsPerPage); const handleNumberInputChange = (e: React.ChangeEvent) => { - const input = e.target.value as string + const input = e.target.value as string; if (input === "") { - setUserPageNum(NaN) - return + setUserPageNum(NaN); + return; } - const numericInput = input.replace(/[^0-9]/g, ''); + const numericInput = input.replace(/[^0-9]/g, ""); if (numericInput !== "") { const newUserPageNum = Number(numericInput); diff --git a/frontend/src/components/forms/Signup.tsx b/frontend/src/components/forms/Signup.tsx index e3fd04ec..b4f49d57 100644 --- a/frontend/src/components/forms/Signup.tsx +++ b/frontend/src/components/forms/Signup.tsx @@ -180,7 +180,6 @@ const Signup = ({ setIsLoading(false); } else { const { requiresTwoFa, authUser } = registerResponse; - console.log(requiresTwoFa, authUser) if (requiresTwoFa) { setToggle(!toggle); } else {