Giter Site home page Giter Site logo

zedcore-coding-challenge's Introduction

Zedcore coding challenge

This is the code for the Zedcore coding interview challenge.

A partial implementation is provided, and there are a number of improvements required.

Scenario

This is a simple report which displays whether some employers have met a key performance indicator (KPI) target.

Improvements required

  1. The start/stop dates are not in a friendly format
  2. Implement Employer::MeetsTarget()
  3. Implement Employer::KPIStyle()
  4. Add a column to display the number of days between the start and stop dates in the table
  5. Display the percentage of employers that meet the threshold at the top of the report

Code structure

We have set out the following classes as a basic scaffolding:

  • Report
    • This handles the bulk of the logic for displaying the report
  • Cell
    • This is used to represent a single cell in a HTML table
    • Each object can be set to represent either a <th> or <td>
  • Employer
    • This represents an employer's performance data to report on.

There are three Twig template to display the report:

  • index.html.twig
    • Handles the main form and page layout
  • report.html.twig
    • Handles the report results table
  • cell.html.twig
    • Handles displaying each inner cell in the table

The templates use Bootstrap4 for styles.

Any custom CSS needed can go into /css/styles.css but you may also make use of Bootstrap4 classes for any styling improvements.

Process flow

When a KPI target is input, the following happens:

  1. The template gets a list of table headers from the Report class and displays them
  2. It then goes through each of the employers and displays the value for each table column

The table headers are defined in Report::TableColumns(). This is an array where the key is the table header and the value is a function to call on each Employer object for each row. Those functions must return a Cell object, so that the content can be displayed correctly.

Running the code

This project requires PHP 7.3 and Composer.

  1. Clone the git repository
  2. Inside the directory, run composer install
  3. Start the inbuilt PHP server using php -S localhost:8000

You can then visit the page by going to localhost:8000 in your browser.

Unit tests

There are some automated unit tests in test/EmployerTest.php which use phpunit to check that the MeetsTarget() and KPIStyle() functions are implemented correctly.

These unit tests must pass for your submission to be considered.

You can run these unit tests with ./vendor/bin/phpunit

PHPUnit will output a report, which should end with the following highlighted in green:

OK (XX tests, YY assertions)

If there are any failures then PHPUnit will end the report with the follwing highlighted in red:

FAILURES!
Tests: XX, Assertions: YY, Failures: ZZ.

Each failure will be reported with an explanation of which test failed, what the expected value was, and what value your code actually produced.

zedcore-coding-challenge's People

Contributors

howardcox avatar patrickrose avatar dependabot[bot] avatar

Watchers

James Cloos avatar  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.