marcpage / scheduling

Restaurant staff scheduling website
The Unlicense
3 stars 4 forks source link

example workflow Issues GitHub pull requests PR's Welcome GitHub contributors GitHub commit activity the past week, 4 weeks

GitHub stars GitHub watchers GitHub forks

Staff Scheduling

Restaurant staff scheduling website

The goal is to have a website that can be deployed to an Amazon Elastic Cloud instance and would support multiple restaurants. This will facilitate the communication of schedule between employees and managers.

Restaurant turn-over is a huge challenge to establishing standard practices in scheduling.

Oh, and I am using this project to help family members get experience in coding in python with a project that has commercial value.

Contents

Why is this public domain

If this fills such a valuable need for restaurants, why are you putting the source in the public domain?

I believe that those who have the technical skills to implement this for their restaurant can save themselves a lot of time and money. For those other restaurants that do not have those with the skills to deploy this, enterprising people with the skills can sell this solution to them. I feel there is a great need in society for this tool. If I try to sell it by myself, I may make a lot of money but I will not be able to fulfill the need as effectively as several people going out and filling that need.

If you wish to sell your services to set this up for a restaurant or even for several restaurants, please do. If you receive feedback, please contribute it back here, but most of all, fill the need.

How to work in the codebase

Assuming the source has been cloned to ~/Documents/scheduling (on cbook is has been).

cd ~/Documents/scheduling

Get the latest source

git pull

Modify the source

Interface

The interface is stored in src/ui and src/ui/template (mainly). These are just web pages, but have special markup to insert variables and have some basic logic.

Logic

The logic behind the interface is stored in src/scheduling.py. This has the logic to perform when the interface makes a request.

Data Model

The data model is stored in src/model.py. This manages the database. In general, you get objects or create objects. If you modify an object you get back, you must call flush() on the model (database.flush()) before returning the webpage. You only have to call flush() once, even for multiple changes to multiple objects.

Check your changes

Make sure all files are saved to disk.

./pr_build.sh fix (Note: pr_build.sh has only been tested on macOS and Ubuntu)

This will reformat your code, and run some checks on it. If any of the checks fail, you must address these problems before submitting.

Run the code

./pr_build.sh run (Note: pr_build.sh has only been tested on macOS and Ubuntu)

This will check the changes again, and start the web server (on port 8000). You can try out your changes by going to http://localhost:8000/

You can make changes while the web server is running and as long as you don't have invalid Python, the server will update to your changes live. This allows you to make changes and refresh the page and see the changes.

Boot-strap process

The first step in the boot-strap process is to create an admin account. The first user to log in creates an admin account.

Screen Shot 2021-12-30 at 10 00 13 PM

Once the admin account is created, the admin can create a restaurant.

Screen Shot 2021-12-30 at 10 01 02 PM

After the restaurant is created, log out and create the general manager account on the restaurant page: http://localhost:8000/restaurant/1

Screen Shot 2021-12-30 at 10 02 43 PM

Log out of the GM's account.

Screen Shot 2021-12-30 at 10 02 54 PM

Log in as the admin account and go to the new restaurant's page.

Screen Shot 2021-12-30 at 10 03 08 PM

Set the GM account on the restaurant page.

Screen Shot 2021-12-30 at 10 03 24 PM

Log out of the admin account and log back into the GM account.

Screen Shot 2021-12-30 at 10 04 33 PM

Go to the restaurant's page and add the roles.

Screen Shot 2021-12-30 at 10 05 15 PM

Log out and create an employee account on the restaurant page: http://localhost:8000/restaurant/1

Screen Shot 2021-12-30 at 10 06 57 PM

You can now set the employee's priority for the different roles.

Screen Shot 2021-12-30 at 10 11 07 PM

Submit the code

First, verify that your changes are still valid.

./pr_build.sh fix (Note: pr_build.sh has only been tested on macOS and Ubuntu)

Create a new source branch

git checkout -b users/my_name/meaningful_change_name

Review your changes

git diff

Review the changes you have made and look for things you missed.

Commit your changes

git commit -a

Press i to start inserting text into the description. Put the full description of your changes (which you reviewed in the last step). When you are done, press esc then type :wq and press return.

Push your changes

git push

The first time you push you will need to connect your branch upstream. Don't worry, git will helpfully give you the full command, which will be something like:

git push --set-upstream origin users/my_name/meaningful_change_name

Any changes you make to this branch after this point will just need git commit -a and git push.

Merge changes from main branch

If there have been changes added to the main branch since your branch was created, you will need to merge those changes back into your branch.

git checkout main \ git pull \ git checkout my_name/meaningful_change_name \ git merge main

If there were any changes in main that conflicted with your changes, they will be marked with HEAD and will show both changes in the same file. Search through your files for HEAD. Fix the conflicts by choosing from main, your branch, or rewrite the code to include both changes.

git commit -a

You can just leave the merge comment and type :wq and press return.

Create a Pull Request

Changes go into main from your branch through a pull request. This allows review of the code to get another set of eyes on it.

Go to https://github.com/marcpage/scheduling/pulls

There should be a green button that says Compare & pull request.

Screen Shot 2021-12-30 at 11 42 43 AM

After the pull request is created, respond to comments, fix anything needed. Changes can be made, and then you can commit and push (see above) to update your branch. Once everything is good, you can complete the pull request (green Squash and merge button near the bottom).

<img width="553" alt="Screen Shot 2021-12-30 at 11 45 48 AM" src="https://user-images.githubusercontent.com/695749/147775964-eb40d818-8ce0-4cb8-b31f-2191726616e8.png">

The confirm the completion by pressing the green Confirm squash and merge button.

Screen Shot 2021-12-30 at 11 45 55 AM

Get ready for the next change

After the pull request is complete, main now has newer source than you have on your machine.

git checkout main \ git pull

You can now go back to the Modify the source step above.

Working on Windows

The commands in pr_build.sh can be used to determine how to work on Windows. Contribution of pr_build.bat to support Windows are definitely welcome.