mirror of
https://github.com/Freika/dawarich.git
synced 2026-01-10 17:21:38 -05:00
13 lines
464 B
Ruby
13 lines
464 B
Ruby
class PointsController < ApplicationController
|
|
before_action :authenticate_user!
|
|
|
|
def index
|
|
start_at = params[:start_at].to_datetime.to_i
|
|
end_at = params[:end_at].to_datetime.to_i
|
|
|
|
@points = Point.all.order(timestamp: :asc)
|
|
@points = Point.all.where('timestamp >= ? AND timestamp <= ?', start_at, end_at).order(timestamp: :asc) if start_at && end_at
|
|
|
|
@coordinates = @points.pluck(:latitude, :longitude).map { [_1.to_f, _2.to_f] }
|
|
end
|
|
end
|