manolobkno08 / ACME

The company ACME offers their employees the flexibility to work the hours they want. But due to some external circumstances they need to know what employees have been at the office within the same time frame

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ACME

Content:

  • classes --> Folder that contains the File class representation.
  • modules --> Folder that contains the methods and validations before generating the final report.
  • tests --> Folder that contains the necessary unit tests to check the correct operation of the application.
  • files --> Folder that contains the files to read.
  • main.py --> File to start the aplication.

Desciption

The company ACME offers their employees the flexibility to work the hours they want. But due to some external circumstances they need to know what employees have been at the office within the same time frame

The goal of this exercise is to output a table containing pairs of employees and how often they have coincided in the office.

Input: the name of an employee and the schedule they worked, indicating the time and hours. This should be a .txt file with at least five sets of data. You can include the data from our examples below:

Example 1:

INPUT
RENE=MO10:00-12:00,TU10:00-12:00,TH01:00-03:00,SA14:00-18:00,SU20:00- 21:00
ASTRID=MO10:00-12:00,TH12:00-14:00,SU20:00-21:00
ANDRES=MO10:00-12:00,TH12:00-14:00,SU20:00-21:00

OUTPUT:
ASTRID-RENE: 2
ASTRID-ANDRES: 3
RENE-ANDRES: 2
Example 2:

INPUT:
RENE=MO10:15-12:00,TU10:00-12:00,TH13:00-13:15,SA14:00-18:00,SU20:00-21:00
ASTRID=MO10:00-12:00,TH12:00-14:00,SU20:00-21:00

OUTPUT:
RENE-ASTRID: 3

Overview Solution

The first step was to really understand the requirement, making a whiteboard to generate a flow from start to finish of the application and dividing the problem into smaller problems.

Once the small problems were identified, I defined the design pattern that best fit, in this case I implemented Singleton, which guarantees the existence of a single object of its type and provides a single point of access.

Finally I developed the application using the OOP paradigm.

FlowChart

Usage

  • Store the files you want to read in the files folder as .txt

Format by line

ANDRES=MO10:00-12:00,TH12:00-14:00,SU20:00-21:00

Interact with app

  • Enter valid username

  • Select valid option

  • Enter the filename you want to read

  • Finally you will see the report

Install

  • Copy the repository
  • Enter the new folder ACME.
  • Run pip install -r requirements.txt to install the test dependencies.
  • Execute the main.py file: python3 main.py or ./main.py

Check Unittest

  • Execute module test python3 -m unittest tests/test_modules/test_read_file.py
  • Execute class test python3 -m unittest tests/test_classes/test_file.py

Authors

About

The company ACME offers their employees the flexibility to work the hours they want. But due to some external circumstances they need to know what employees have been at the office within the same time frame


Languages

Language:Python 100.0%