Skip to content

Geektrust code scheduler with proper LLD, design pattern and unit test in python.

Notifications You must be signed in to change notification settings

ninjakx/course_scheduler

Repository files navigation

course_scheduler

Hits

Context

The head of the Learning management system (LMS) has hired you as a consultant. The LMS team has the goal of upskilling the employees with the latest topics via courses. You need to help build a system to schedule and manage the courses.

Pre-requisites

  • Python 3.8/3.9
  • Pip

How to execute the unit tests

python -m unittest discover will execute the unit test cases.

The unit test coverage is found by the command : coverage run -m unittest discover

This covers Design patterns like singleton, also uses interfaces and following:

Object Modelling (OOPS)

  • Solution follows some modelling principles.
  • Code maintains encapsulation. No encapsulation breakages were found.

Readability

  • Solution follows clean code principles and is well readable.
  • Code follows the single responsibility principle.
  • Code is structured and split across multiple files thereby improving its readability.
  • Code is written with compact methods. Shorter, compact methods help in improving readability.
  • Code has good usage of easily understandable names for methods, classes, and variables. This makes code easy to understand.
  • Submission has very few magic numbers, making it easy to read and maintain.

Unit Tests

  • Contains all the unit tests for every methods.

Build

  • Not getting build there :/ but works fine in the local environment.

Maintainability

  • Code is maintainable. It doesn’t contain complex methods. Code is spread evenly across methods.
  • Code had minimal code duplication. The submission follows DRY principles. This helps in increasing readability and helps in maintaining code.

Correctness( I/O) Some issue in the portal side not running there.

To run the app:

bash run.sh

Output:

OFFERING-PYTHON-JOHN
REG-COURSE-WOO-PYTHON ACCEPTED
REG-COURSE-ANDY-PYTHON ACCEPTED
REG-COURSE-BOBY-PYTHON ACCEPTED
REG-COURSE-BOBY-PYTHON CANCEL_ACCEPTED
REG-COURSE-ANDY-PYTHON [email protected] OFFERING-PYTHON-JOHN PYTHON JOHN 05062022 CONFIRMED
REG-COURSE-WOO-PYTHON [email protected] OFFERING-PYTHON-JOHN PYTHON JOHN 05062022 CONFIRMED

To see the coverage:

coverage run -m unittest discover

OR

python3 -m unittest 

Output:

.OFFERING-JAVA-JAMES
...REG-COURSE-WOO-JAVA CANCEL_REJECTED
..REG-COURSE-WOO-JAVA CANCEL_ACCEPTED
................INPUT_DATA_ERROR
......
----------------------------------------------------------------------
Ran 28 tests in 0.013s

OK

To run particular test:

python3 -m unittest src/tests/CmdExecutorTest/test_CancelCourseCmdExecutor.py

Output:

REG-COURSE-WOO-JAVA CANCEL_REJECTED
..REG-COURSE-WOO-JAVA CANCEL_ACCEPTED
.
----------------------------------------------------------------------
Ran 3 tests in 0.000s

OK

To remove pycache:

find . -type d -name __pycache__ -exec rm -r {} \+

Releases

No releases published

Packages

No packages published

Languages