Giter Club home page Giter Club logo

tangent_leave_app_solution's Introduction

Leave application system

Setting up environment for this project

  1. This project was built using python 2.7.13.
  2. The packages in the requirements.txt file should be installed.
pip install -r requirements.txt
  1. As this is a mini application, SQLite Database was used.

  2. open a terminal and clone the repository as follows:

git clone https://github.com/popsonebz/tangent_leave_app_solution.git

This creates a folder called tangent_leave_app_solution in the current directory.

  1. switch to that directory
cd tangent_leave_app_solution
  1. To create the database and tables, run the migration command
python manage.py migrate
  1. We can now startup the server
python manage.py runserver localhost:8010

Admin Operation

First of all, we need to add employees to the system

http://localhost:8010/admin/add-employee/

Note:

  1. By default, all employees have 18 days of leave.
  2. This page was just added based on initiative as it was not specified in the task.

Employee Operation

  1. To apply for leave, the employee visits this url

http://localhost:8010/leave/apply

  1. He/She is redirected to the login page for authentication

  2. If Authentication is successful, the application page is displayed.

  3. On selecting the start and end dates, the following are checked:

  • Both either start or end date or end date cannot be less than the current date.
  • The end date cannot be less than the start date.
  • Start date cannot later than end date.
  • End date cannot be the same as start date.
  • Notify the user when there is no working days within the specified period.
  • Preventing duration which exceeds the maximum 18 days of leave allocated.

Automatically Decline the following leave application:

  • Employees who have not spent up to 3 months in the company from appying for leave.
  • Employee who has exhausted his leave.
  • Employee taking more than the remaining leave days he has.

Selenium Functional Test

Note: To use the functional test, the following needs to be done:

  1. Chrome webdriver needs to be downloaden and placed into the folder path (tanget_leave_app_solution/leave/)

  2. The webdriver path needs to be set accordingly as seen in leave/test.py (the current path only works on my laptop).

  3. Open the link http://localhost:8010/admin/add-employee/

  4. Create the following users:

first name = kate, last name = perry, employment date = 01/01/2017, username = kate, password= kate

first name = ben, last name = carson, employment date = 29/05/2017, username = ben, password= ben

  1. Then run the command:
   python manage.py test

Carrying Over Leave Not Taken

The system carry's over a maximum of 5 days leave.

This is done in the management command defined in leave/management/commands/carry_leave_over_the_year.py

The operation can be carried out in 2 ways:

  1. Manually at the end of the year
   python manage.py carry_leave_over_the_year
  1. Automatically by creating a linux crontab job which executes once a day to check if its the last day of the year.

if the condition is met, the command in option 1 will be executed.

tangent_leave_app_solution's People

Contributors

popsonebz avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.