Code Monkey home page Code Monkey logo

stats's Introduction

Stat Tracker

Build a single-serving (only one user, you!) rails application to help track some metric that is important to you.

  • Pick a theme
  • Create a Stat Model (you can call it whatever you like, i.e. SleepStat, MoodLog, FocusMetric)
    • Stat column of type integer or float (again, called whatever you would like, i.e. hours, batting_average)
    • Any additional columns you would like to track.
    • Use the auto-generated created_at column to keep track of when the stat was recorded
  • Create a Stat Controller with the following methods:
    • index
      • Renders a view which lists all of the stats in a <table>
      • Includes a form to add a new stat
      • A button for each stat in the table to delete that stat (for mistakes)
    • add_stat
      • Adds a Stat to the database
      • redirects to index if successful
      • renders index with error messages if fails
    • remove_stat
      • Url needs an id of a stat
      • The stat with that id is removed from the database
      • Redirects to the index page
  • Design the page to match the themes you've chosen

Keep this application as simple as possible. Spend time studying each piece and identifying the HTTP cycle through rails which happens with any given page load or form submission. Try some alternate study methods to get the concepts down, like drawing a diagram of your application or writing out in a english what is happening inside rails.

Extended Requirements

  • Hide the form on index, use a toggle button to show the form when clicked.
  • Add a method to the Stat model to return an average overall value for the stat, integrate this number into the design.
  • Style each stat entry on the index page with a custom style (i.e. three different classes high, medium, low conditionally added based on the stat)
  • Add an addition form which allows you to select specific time periods. The average number shown above should show the average for the selected period.

stats's People

Contributors

khambro avatar

Watchers

 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.