Sha256: 700efc7a399674e83f605b1ff9ce0d6ccab212d2440b5a23a26c81572028f106
Contents?: true
Size: 816 Bytes
Versions: 2
Compression:
Stored size: 816 Bytes
Contents
class Iro::DatapointsController < Iro::ApplicationController ## params: d, k, v def create begin Iro::Datapoint.create( k: params[:k], v: params[:v], created_at: params[:time] ) render json: { status: :ok } rescue ActiveRecord::NotNullViolation => exception render json: { status: :unauthorized }, status: :unauthorized end end def index # from = '2023-12-20' # to = '2023-12-01' # points = Iro::Datapoint.where( k: params[:k] ).joins( :dates ) sql = "SELECT dps.k, dps.v, d.date FROM iro_datapoints as dps RIGHT JOIN dates d ON d.date = dps.d WHERE d.date BETWEEN '2023-12-01' AND '2023-12-31' ORDER BY d.date;" outs = ActiveRecord::Base.connection.execute(sql) puts! outs, 'outs' render json: outs end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
iron_warbler-2.0.7.10 | app/controllers/iro/datapoints_controller.rb |
iron_warbler-2.0.7.9 | app/controllers/iro/datapoints_controller.rb |