Coder Social home page Coder Social logo

sager_app's Introduction

README

  • Version information

  • ruby-2.0.0-p195

  • rails 4.0.0.rc1

  • System dependencies

  • Configuration

  • Database creation

  • Database initialization

  • How to run the test suite

  • Services (job queues, cache servers, search engines, etc.)

  • Deployment instructions

Please feel free to use a different markup language if you do not plan to run rake doc:app.

sager_app's People

Contributors

akurilin avatar sionc avatar

Stargazers

 avatar

Watchers

 avatar  avatar

sager_app's Issues

/sensor_readings index displays readings in broken order

Seeing stuff like this on the heroku site:

228 1 June 3rd, 2012 22:41
227 1 June 3rd, 2012 22:40
229 1 June 3rd, 2012 22:39
227 1 June 3rd, 2012 22:38
226 1 June 3rd, 2012 22:37
226 1 June 4th, 2012 14:48
234 1 June 4th, 2012 14:47
224 1 June 4th, 2012 14:46
224 1 June 4th, 2012 14:45
220 1 June 4th, 2012 14:44

No clue about why just yet.

Failing static_pages request spec

[alex@arch_lianli sager_app]$ bundle exec guard
Guard uses NotifySend to send notifications.
Guard is now watching at '/home/alex/code/sager_app'
Guard::RSpec is running, with RSpec 2!
Running all specs
....................................................F..

Failures:

  1. StaticPages Home page should have the content 'Home'
    Failure/Error: page.should have_content('Home')
    expected there to be content "Home" in "Sager\n \n Sager\n\n Overview\n \n \n About Us\n \n\n \n \n \n \n \n \n \n \n \n \n \n \n \n\n\n \n \n "

    ./spec/requests/static_pages_spec.rb:9:in `block (3 levels) in <top (required)>'

Finished in 1.48 seconds
55 examples, 1 failure

Failed examples:

rspec ./spec/requests/static_pages_spec.rb:7 # StaticPages Home page should have the content 'Home'
Coverage report generated for RSpec to /home/alex/code/sager_app/coverage. 107 / 107 LOC (100.0%) covered.

2 sensor_spec.rb model test cases take too long

The top two test cases below take a really long time to execute. Let's try to keep everything really snappy, and just do enough functionality validation to allow us to sleep well at night. Let's try to keep it under 100msec, if possible.

~/code/sager_app/spec/models (develop)$ rspec sensor_spec.rb -p
.........

Top 9 slowest examples:
Sensor should calculate kwh usage for the week upto the given date
7.52 seconds ./sensor_spec.rb:89
Sensor should calculate kwh usage for a given date
1.02 seconds ./sensor_spec.rb:66
Sensor should calculate kwh usage for one hour for a given date and hour
0.24685 seconds ./sensor_spec.rb:47
Sensor should not have an empty or nil name
0.2077 seconds ./sensor_spec.rb:4
Sensor should be able to have same local id across hubs
0.03111 seconds ./sensor_spec.rb:30
Sensor should be able to have duplicate names for different hubs
0.03047 seconds ./sensor_spec.rb:17
Sensor should not have a duplicate name for the same hub
0.0226 seconds ./sensor_spec.rb:10
Sensor should not have same local id for one hub
0.01976 seconds ./sensor_spec.rb:39
Sensor should not exist without an associated hub
0.00708 seconds ./sensor_spec.rb:24

Move sensor usage methods into a controller/helper

Currently, the usage data is calculated in the model and the as_json method is modified to append these virtual attributes to the json string. We should consider getting rid of these methods from the model and performing these calculations in the controller or helper.

Use the user's time zone for calculating usage averages

For the sake of simplicity, currently sensor.rb model uses UTC for hourly, daily and weekly usage calculations. However, when we are displaying data to the user, we should display the data in the user's time zone. We can do so by passing in the time offset from UTC to the controller.

user_sensors route is a duplication

In app/controllers/pages_controller.rb there's a chunk of code that says:

# GET /pages/user_sensors.json
def user_sensors
    @user_sensors = current_user.sensors

    respond_to do |format|
      format.json { render json: {:sensors => @user_sensors} }
    end
  end

This is really the job of app/controllers/sensors_controller.rb

def index
  @sensors = Sensor.all

  respond_to do |format|
    format.html # index.html.erb
    format.json { render json: @sensors }
  end
end

Since the sensors index should be restricted to only one user by default,
you can either change that action, or keep this issue open until I add in the
CanCan gem.

My point is that we most likely do not need there two separate actions and
routes for the same operation.

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.