orestes7054 / acme

App to calculate salary of Acme's Employees

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Architecture

The main function of the program is to compute the total payment amount for the employees of the ACME Company. The input is a .txt file with this format:

RENE=MO10:00-12:00,TU10:00-12:00,TH01:00-03:00,SA14:00-18:00,SU20:00-21:00

The output:

The amount to pay RENE is: 215 USD

Directory Tree

./
├── ACME
│ ├── acme.txt
│ ├── errors.py
│ ├── __init__.py
│ ├── __main__.py
│ ├── payment_class.py
│ ├── payment.json
│ └── utils.py
├── acme_employee_payment_roll.txt
├── LICENSE
├── README.md
├── result.html
├── setup.py
└── test
    ├── data
    │ ├── empty_file.txt
    │ ├── test_acme_five_employees.txt
    │ ├── test_acme.txt
    │ └── wrong_format.jpg
    ├── __init__.py
    └── test_acme.py


5 directories, 25 files


Sorted by hierarchy the ACME file contains the core operations. In payment_class.py is the main class that make the computation. In utils.py are the function to check the user's input, clear the data and transform text to datetime objects. In errors.py are the classes for erorrs. I tried to keep the project as simple as posible and don't abuse the Classes' use; avoiding the re-calling of simple functions. The test folder includes all the neccesary elements to test the code. The setup.py is use to create all the neccesaries elements to make a module of every folder with no problems. Related to setup.py

In the utils.py the functions are concatenate, this is a practice I inherit from VBA where you usually call a function from a function and run the program consecutively, this is also use in Google Apps Script. The days and payment information is in the payment.json file; the AcmeEmployee class reads this file and obtain the data.

ACME

Installation via PIP

pip install acme-ioet-orestes

Then use terminal with:

For instructions

ACME -h

To see and example:

ACME -example

To use the program

ACME <path to the .txt file>

If you want to save a copy of the output:

ACME -sc <path to the .txt file>

Manual Installation

git clone https://github.com/orestes7054/acme.git
cd acme
pip install .

For instructions

python ACME -h

To see and example:

python ACME -example

To use the program

python ACME <path to the .txt file>

If you want to save a copy of the output:

python ACME -sc <path to the .txt file>

Test

git clone https://github.com/orestes7054/acme.git
cd acme
pip install .
python -m unittest -v

Assumptions

  1. The employees can not make portion of hour, they have to submit a complete hour.
  2. An employee can not make just one day of work, the program will not read a line like this: RENE=MO10:00-15:00. If this assumptions is not correct, to change this and read just one day we need to change the check_line function regex.

NOTE: The use of the command <pip install .> is to avoid dependencies problems. For some version of linux (ubuntu 18.04 for example) the use of is not recommended. For use is recommended the pip via install.

About

App to calculate salary of Acme's Employees

License:MIT License


Languages

Language:Jupyter Notebook 73.7%Language:Python 26.3%