Coder Social home page Coder Social logo

node-coding-exercise's Introduction

GSTV BE Coding Exercise

Notes from Ryan

  1. Be sure to install all packages with 'npm install' in the main directory.
  2. Please start the app with 'npm start', or otherwise 'node --harmony ./web/app/app.js start', as this will run it using the harmony flag within the 'start' script in package.json.
  3. All the basic functionality is complete. Essentially, I coded this as an 'edit-by-week' interface. You make changes to each day in the week, and submit the entire week. Only days that have been changed will be saved (ie. have any data).
  4. Only extra credit #1 is complete (check future date)
  5. I made an assumption that an 'overlap' time does not mean a timeslot that ends at the same time another begins. This is assumed valid.

Index

  1. Exercise Overview
  2. System Requirements
  3. Version Control
  4. JavaScript

Exercise Overview

The site - an individual gas station - is the most atomic piece of the GSTV business model - it is at the core of everything we do. Our hardware is installed at the site, advertisers purchase impressions at a site level and schedules are generated on a per-site basis. Thus, keeping accurate information about a site is essential to maintaining business operations.

We are asking you to build out the ability to create, edit and view hours for a given site. We are focusing on the way you approach the services, and structure the Mongo documents - there is no expectation of a polished UI. We want you to focus on the server-side aspects of implementing these requirements.

This data is used to help us know when to turn on and off hardware, how many times a video asset is expected to play and at its most basic level, whether the site is open when we try to call them.

A site may have multiple open and close times for a single day. For example they may be open in the morning, but close mid-afternoon and reopen for the after work rush hour. In many cases stations will be open past midnight, but business owners do not necessarily think of this as the next day.

Taco Bell is a perfect example of business hours vs. chronological hours - they may be open until 4am on Sunday, but you still think of it as Saturday night.

Creating and Editing Hours

Edit & Create Site hours have the same business rules. The main difference is that on edit the dropdowns and values are prepopulated, while in add they are blank.

  • Format

    • For each day of the week
      • Day Label
        • Full name
      • Each day may have one or many time slots
      • For each Time Slot
        • Open Time
          • Dropdown
            • Values are in 30 minute increments
            • Values are in AM/PM format
            • Values
              • Start at Midnight and end 11:30 PM
        • Close Time
          • Dropdown
            • Values are in 30 minute increments
            • Values are in AM/PM format
            • Values
              • Start at 12:30 AM and end at 6:00 AM (next day)
              • All values past 11:30 PM (values between Midnight and 6:00 AM) should have the text (next day) at the end
        • Remove Button
      • Open 24 Hours Button
      • Add Button
    • Close Button
    • Submit Button
  • Functionality

    • Remove Button
      • Removes the selected time slot
      • If Open 24 Hours
        • Removes Open 24 Hours message
        • Displays one empty time slot
    • Add Button
      • Adds an additional time slot to the selected day
    • Open 24 Hours Button
      • Removes all the time slots if any exist
      • Hides Open 24 Hours Button
      • Message
        • Open 24 Hours
    • Close Button
      • User is returned to the spot where they opened the wizard and the view not reflect any changes
    • Submit Button
      • FE Validates values
        • Null Validation
          • If a start time is entered a close time is required
          • If a close time is entered a start time is required
            • Submit fails
              • Message
                • Unable to Create/Update: {itemName} is required.
        • Overlap/Duplicate Validation
          • If a timeslot for a given day overlaps any other time slots on the same day
            • Submit fails
              • Message
                • Unable to Create/Update: there is at least one overlapping timeslot
        • Time Slot Format Validation
          • If the start time falls after the end time
            • Message
              • Unable to Create/Update: The start time must be before the end time
          • If the end time falls before the start time
            • Message
              • Unable to Create/Update: The start time must be before the end time
          • If the start time falls on the end time
            • Messages
              • Unable to Create/Update: The start time may not be the same date as the end time
        • If FE validation passes
          • Submit changes to the BE
      • BE validates values
        • Null Validation
          • If any required items are null
            • Submit fails
              • Message
                • Unable to Create/Update: {itemName} is required.
        • Unchanged Data Validation
          • If any required items are null
            • Submit fails
              • Message
                • Unable to Update: {itemName} {itemValue} has not been changed.
        • Duplicate Validation
          • If any required items are null
            • Submit fails
              • Message
                • Unable to Create/Update: {itemName} {itemValue} already exists.
        • Malformed Data Validation
          • If any required items are null
            • Submit fails
              • Message
                • Unable to Create/Update: {itemName} {itemValue} does not match the expected format.
        • Time Slot Format Validation
          • If the start time falls after the end time
            • Message
              • Unable to Create/Update: The start time must be before the end time
          • If the end time falls before the start time
            • Message
              • Unable to Create/Update: The start time must be before the end time
          • If the start time falls on the end time
            • Message
              • Unable to Create/Update: The start time may not be the same date as the end time
          • If BE validation passes
            • Update Data
              • User is returned to the spot where they opened the wizard and the view will reflect changes from the wizard.

Viewing Hours

  • Format
    • Normal State
      • For current date/time
        • Open or Closed
          • Rules
            • If current date and time is within a defined open period, then Open
            • If current date and time is not within a defined open period, then Closed
      • For each day
        • Day Label
          • Full name
        • If not Open 24 hours
          • For each time slot
            • Open Time
            • Close Time
        • If Open 24 hours
          • Message
            • Open 24 hours
        • If Hours are Null
          • Message
            • Closed
      • Edit Site Hours Button
    • Empty State
      • Message
        • There are no site hours for {Site ID}.
      • Create Site Hours Button
  • Functionality
    • Edit Site Hours Button
      • Links to Creating/Editing Hours
    • Create Site Hours Button
      • Links to Creating/Editing Hours

Extra Credit

Future Date/Time Open or Closed

Our field operations team often goes to sites for maintenance or upgrades. While creating their schedules it would be helpful to know if a site will be open on a given date and time in the future.

Timezones

GSTV has sites across the US. People from the Detroit main office may be calling sites in California. For that reason it is important to know the open times based upon a given timezone.

Daylight Savings Time

GSTV has sites in Arizona. Arizona does not participate in daylight savings time. For that reason it is important to know the open times based upon a site’s participation in daylight savings.

System Requirements

  • Node.js ^4.0.0
  • MongoDB ^3.0.0

Version Control

GitFlow and GithubFlow

We use GitFlow on a daily basis - this allows us to build quality control into our development, QA and deployment process.

We are asking that you use a modified Github Flow - sometimes referred to as a feature branch workflow - methodology instead of GitFlow. Conceptually, GitFlow and Github flow are similar.

Please fork our repository and use a feature branch workflow while developing your functionality. When you are ready to submit your work make a pull request against our repository.

JavaScript

Standards

We have a work in progress style guide that you can refer to. We don't expect you to strictly adhere to these standards, but they may help provide insight into how our JavaScript is generally structured.

Unit Testing

Please feel free to create unit tests - we use Mocha.

node-coding-exercise's People

Contributors

rw3iss avatar acolson avatar sfhorton01 avatar

Watchers

 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.