ahoy_panel 0.0.26 → 0.0.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f2fabbd234afda0dcf7a2d6ceaf50effad8e2f0d13ab187c23670165fa11feb7
4
- data.tar.gz: c22f7c8215ea99e4f2a74a7cc9e72a78505a33d7d506b319a592437094a04eaa
3
+ metadata.gz: c3e036c634e518074d4c850f65168a3f04afa102f9ea90735af6d9a9965a956a
4
+ data.tar.gz: 73b2e2680374cb098f9af193bdba57afd9999985593b70e10fe0f59714c67b63
5
5
  SHA512:
6
- metadata.gz: a480c83e46527a059b4d79d8ae30ae7bd52a11274ef478ad8191c370a5d967b4a5ad1cf1b2b9cea35d49473d7b6860fe3003601820dfa1fb1e29f46b8a6b245f
7
- data.tar.gz: 29c10a4bb3e2e2672b4226dd055c648f9b1e8de1c6da84164f8404b726aaf32b8925a9fc2db80a34fd367a1f8e452f778c2bd24740202ce3dc387adc80f6c3d7
6
+ metadata.gz: d756a60f63a5e6050f778042eac57142228f308358373a41eb1b46912ac711af9080ec2b53232230962366c446acdf68a1effb171c6254f09a5796683fca8af0
7
+ data.tar.gz: 9e911f57ee73adad0db11956a40ec55ba956b316edf6b9235217e59a59d63cfbc11b8f23e21a35536ff024354c690e403be1cdda2024fceb6769f2e40e79c113
@@ -4,6 +4,7 @@ module AhoyPanel
4
4
  @start_date = params[:start_date].to_date.beginning_of_day
5
5
  @end_date = params[:end_date].blank? ? nil : params[:end_date].to_date.end_of_day
6
6
  @page = params[:page]
7
+ @filtering_params = JSON.parse(params[:filtering_params], symbolize_names: true)
7
8
 
8
9
  @date_range = if @end_date.blank?
9
10
  @start_date..params[:start_date].to_date.end_of_day
@@ -13,6 +14,19 @@ module AhoyPanel
13
14
 
14
15
  @events = ::Ahoy::Event.where(time: @date_range).order(:id)
15
16
 
17
+ @filtering_params.each do |key, value|
18
+ case key
19
+ when :id
20
+ @events = @events.where(id: value.to_i)
21
+ when :visit_id
22
+ @events = @events.where(visit_id: value.to_i)
23
+ when :user_id
24
+ @events = @events.where(user_id: value.to_i)
25
+ when :name
26
+ @events = @events.where("name ilike ?", "%#{value}%")
27
+ end
28
+ end
29
+
16
30
  if @page.present?
17
31
  @events = @events.page(@page)
18
32
  end
@@ -20,6 +34,12 @@ module AhoyPanel
20
34
  render json: { events: @events, total_count: @page.present? ? @events.total_count : nil }
21
35
  end
22
36
 
37
+ def show
38
+ @event = ::Ahoy::Event.find(params[:id])
39
+
40
+ render json: @event
41
+ end
42
+
23
43
  def dates
24
44
  start_date = ::Ahoy::Event.order(time: :asc).first.time.to_date
25
45
  end_date = ::Ahoy::Event.order(time: :desc).first.time.to_date
data/config/routes.rb CHANGED
@@ -3,5 +3,5 @@ AhoyPanel::Engine.routes.draw do
3
3
  resources :visits, only: [:index, :show]
4
4
 
5
5
  get "event_dates", to: "events#dates"
6
- resources :events, only: [:index]
6
+ resources :events, only: [:index, :show]
7
7
  end
@@ -1,3 +1,3 @@
1
1
  module AhoyPanel
2
- VERSION = "0.0.26"
2
+ VERSION = "0.0.28"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ahoy_panel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.26
4
+ version: 0.0.28
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Jeon
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-04-01 00:00:00.000000000 Z
10
+ date: 2025-04-02 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: rails