Sha256: 95fd1c48a3f5d0e74eba018c075cbead05b85a777b2845af0e3fd98fa2b1c37d

Contents?: true

Size: 952 Bytes

Versions: 3

Compression:

Stored size: 952 Bytes

Contents

require_dependency "heart/application_controller"

module Heart
  class AnnotationsController < ApplicationController
    
    def create
      fulldate = Time.at((params[:fulldate].to_i / 1000)+32400) #flot stores dates in UTC format, so have to add 9 hours to the time to get correct date
      annotation = Heart::Annotation.where(:fulldate => fulldate).first || Heart::Annotation.new(:fulldate => fulldate)
      annotation.note = params[:note]
      annotation.dashboard_id = params[:dashboard_id]
      annotation.save!
      @annotations = Heart::Annotation.visible(:from => Date.parse(params[:date_from]), :to => Date.parse(params[:date_to]))
    end

    def description
      annotation_hash = {:fulldate => '2999-12-31', :dashboard_id => params[:dashboard_id], :note => params[:note]}
      @annotation = Heart::Annotation.where(annotation_hash).first || Heart::Annotation.new(annotation_hash)
      @annotation.save!
    end
    
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
heart-0.0.2 app/controllers/heart/annotations_controller.rb
heart-0.0.1 app/controllers/heart/annotations_controller.rb
heart-0.0.1.pre app/controllers/heart/annotations_controller.rb