Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/marcpage/scheduling

Restaurant staff scheduling website
https://github.com/marcpage/scheduling

Last synced: 9 days ago
JSON representation

Restaurant staff scheduling website

Awesome Lists containing this project

README

        

[![example workflow](https://github.com/marcpage/scheduling/actions/workflows/CI.yml/badge.svg)](https://github.com/marcpage/scheduling/actions/workflows/CI.yml) [![Issues](https://img.shields.io/github/issues-raw/marcpage/scheduling?maxAge=25000)](https://github.com/marcpage/scheduling/issues) [![GitHub pull requests](https://img.shields.io/github/issues-pr/marcpage/scheduling?style=flat)](https://github.com/marcpage/scheduling/pulls) [![PR's Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat)](http://makeapullrequest.com) [![GitHub contributors](https://img.shields.io/github/contributors/marcpage/scheduling?style=flat)](https://github.com/marcpage/scheduling/graphs/contributors) [![GitHub commit activity the past week, 4 weeks](https://img.shields.io/github/commit-activity/y/marcpage/scheduling?style=flat)](https://github.com/marcpage/scheduling/pulse)

[![GitHub stars](https://img.shields.io/github/stars/marcpage/scheduling?style=social&label=Star)](https://github.com/marcpage/scheduling/stargazers)
[![GitHub watchers](https://img.shields.io/github/watchers/marcpage/scheduling?style=social&label=Watch)](https://github.com/marcpage/scheduling/watchers)
[![GitHub forks](https://img.shields.io/github/forks/marcpage/scheduling?style=social&label=Fork)](https://github.com/marcpage/scheduling/network/members)

# 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.
* Wouldn't it be great as a restaurant employee if there was a standard way to communicate when you want to work, when you could work, when you'd rather not work, and when you cannot work?
* Wouldn't it be great as a schedule manager or general manager if you could have a system that takes employee input, your input and automatically creates a starting point for the schedule for each week?
* Wouldn't it be great as an employee if you had to have someone cover you you could have a list of employees ranked from those who would most like to work that shift to least like to work that shift?

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](#why-is-this-public-domain)
* [How to work in the codebase](#how-to-work-in-the-codebase)
* [Get the latest source](#get-the-latest-source)
* [Modify the source](#modify-the-source)
* [Interface](#interface)
* [Logic](#logic)
* [Data Model](#data-model)
* [Check your changes](#check-your-changes)
* [Run the code](#run-the-code)
* [Boot-strap process](#boot-strap-process)
* [Submit the code](#submit-the-code)
* [Create a new source branch](#create-a-new-source-branch)
* [Review your changes](#review-your-changes)
* [Commit your changes](#commit-your-changes)
* [Push your changes](#push-your-changes)
* [Merge changes from main branch](#merge-changes-from-main-branch)
* [Create a Pull Request](#create-a-pull-request)
* [Get ready for the next change](#get-ready-for-the-next-change)
* [Working on Windows](#working-on-windows)

# 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).

`Screen Shot 2021-12-30 at 11 45 48 AM

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](#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.