clark_kent 0.8.9 → 0.8.10
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f7455a5b7bb8bbd0dbff552b602c5fa7bee82286
|
4
|
+
data.tar.gz: 41c44657ae8564900914b274b7206ffda749bc5b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4cd74c6cad18ced8ddc123dacf14e63c82a66fd5b2e641496e6c9532993212f4ae0878bd682a3d501a9c6cded5879dbaaa24129ea3c5d7cc9adafa8b21bf185b
|
7
|
+
data.tar.gz: 6095ea444bdd97a9d8054082a23cc06b3af7071b8e6adfd005d59bafba90f695e9aa03e0030b33ec3edc5464987745f33d6957c988f22c228166e1112bbf2caf
|
@@ -30,6 +30,13 @@ class ClarkKent::ReportsController < ClarkKent::ApplicationController
|
|
30
30
|
else
|
31
31
|
prepare_params(params.permit!) if defined? prepare_params
|
32
32
|
if params[:run_report].present?
|
33
|
+
@these_params.each do |k,v|
|
34
|
+
if @report.date_filter_names.detect{|fn|
|
35
|
+
@report.filter_options_for(fn).filter_params.include? k.to_s
|
36
|
+
}.present?
|
37
|
+
@these_params[k] = parse_date(v)
|
38
|
+
end
|
39
|
+
end
|
33
40
|
@these_params[:page] = params[:page]
|
34
41
|
@these_params[:per] = @report.resource_class.default_per_page
|
35
42
|
begin
|
@@ -96,4 +103,28 @@ class ClarkKent::ReportsController < ClarkKent::ApplicationController
|
|
96
103
|
params.require(:report).permit(:name, :resource_type, :sharing_scope_id, :sharing_scope_type)
|
97
104
|
end
|
98
105
|
|
106
|
+
def parse_date(date_input)
|
107
|
+
begin
|
108
|
+
date = american_parse(date_input)
|
109
|
+
date ||= Date.parse(date_input)
|
110
|
+
rescue ArgumentError
|
111
|
+
return nil
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
def american_parse(string)
|
116
|
+
string.gsub!("%2F", "/")
|
117
|
+
month,day,year = string.split('/').map{|part| part.to_i}
|
118
|
+
return nil unless [month,day,year].all? { |c| !!c }
|
119
|
+
year = normalize_year(year)
|
120
|
+
Date.new(year,month,day)
|
121
|
+
end
|
122
|
+
|
123
|
+
def normalize_year(year)
|
124
|
+
if year < 100
|
125
|
+
year = year + ((Date.today.year / 100) * 100)
|
126
|
+
end
|
127
|
+
year
|
128
|
+
end
|
129
|
+
|
99
130
|
end
|
data/lib/clark_kent/version.rb
CHANGED
@@ -50,7 +50,7 @@ class ClarkKent::ReportsControllerTest < ControllerTest
|
|
50
50
|
end
|
51
51
|
|
52
52
|
it "should show report results" do
|
53
|
-
get :show, params: {id: report, current_user_id: current_user.id, run_report: true, created_at_until: Date.today, created_at_from: Date.yesterday}
|
53
|
+
get :show, params: {id: report, current_user_id: current_user.id, run_report: true, created_at_until: Date.today.strftime("%m/%d/%Y"), created_at_from: Date.yesterday}
|
54
54
|
assert_response :success
|
55
55
|
@response.body.must_match 'Guitar strings'
|
56
56
|
end
|
data/test/dummy/db/test.sqlite3
CHANGED
Binary file
|