This is the implementation of a system that randomly allocates rooms to Andela fellows and staff at the Dojo.
- Create rooms, which can be of type Office or Living Space
- Add people to the Dojo. The people can be Fellows or Staff members
- Randomly allocate offices to staff and fellows. Randomly allocate living spaces to fellows that choose to opt in.
- Load People from a txt file directly into the system.
- Print Allocations of fellows and staff in the various rooms.
- Print all unallocated fellows and staff
- Print all available rooms and the spaces available in each room.
- Load state from a previously saved database
- Save all data you've worked on during a particular session.
$ git clone https://github.com/dmwiine/SpaceAllocator.git
$ cd your-dir
$ pip3 install requirements.txt
$ python3 dojo_main.py -i
This command creates offices and living_spaces in the Dojo. You can create as many offices/living_spaces as you want.
create_room <room_type> <room_name> ...
create_room office Red Blue Yellow Pink
create_room living_space A B C D
This command creates a new person and automatically assigns them office or living space as per the user’s specifications .
add_person <first_name> <last_name> <person_type> [<wants_accommodation>]
add_person Donna Mwiine Staff
add_person Daphne Murungi Fellow Y
add_person David Kimathi Fellow
This command prints all the people allocated to a particular room.
print_room <room_name>
print_room Yellow
This command prints all fellow & staff allocations assigned to a particular room. An optional file name may be provided in which case the results will be saved to a text file.
print_allocations [—-o=<filename>]
print_allocations
print_allocations allocations.txt
This command reallocates a person to the new room specified. It takes a person’s name and a room name to reallocated them to.
reallocate_person <first_name> <last_name> <new_room_name>
reallocate_person Donna Mwiine Pink
This command prints all the fellows and staff that have not been assigned rooms. An optional file name may be provided in which case the results will be saved to a text file.
print_allocations [—-o=<filename>]
print_allocations my_file_name.txt
This prints all the offices and living rooms that have space and how much space they have.
print_available_rooms
This command loads people data from a text file. This text file can be found in Files/inputs.txt .
load_people
This command saves the data in the current session to a database.
save_state
This loads data from a previously saved session.
load_state
Enables you to run tests on the different parts of the application to ensure that they are running as intended.
Open the terminal, cd into the project folder and type in the command below to run tests on the program. Please remember to use the correct python installation on your system.
python3 -m unittest Tests/<test_file_name>
Determine the percentage of code tested.
coverage run -m unittest discover -s Tests
Use the commands below to print out a simple command-line report. Be sure to cd into the project folder first.
coverage report -m