clark_kent 0.3.2 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (30) hide show
  1. checksums.yaml +4 -4
  2. data/app/helpers/clark_kent/application_helper.rb +10 -1
  3. data/app/models/clark_kent/report.rb +1 -1
  4. data/app/models/clark_kent/report_column.rb +8 -0
  5. data/app/models/clark_kent/report_config.rb +1 -1
  6. data/app/views/clark_kent/reports/show.html.erb +1 -1
  7. data/lib/clark_kent/version.rb +1 -1
  8. data/test/dummy/db/test.sqlite3 +0 -0
  9. data/test/dummy/log/test.log +1180 -0
  10. data/test/dummy/tmp/cache/assets/sprockets/v3.0/7wkkNeyL-5f8CXSn7mMl8AVNJDqKAiYwQs3n_B6mQyU.cache +0 -0
  11. data/test/dummy/tmp/cache/assets/sprockets/v3.0/8S9BWbkqyqZJQUbtQschJbKqEQhGcIJGHi3MQwciyag.cache +1 -0
  12. data/test/dummy/tmp/cache/assets/sprockets/v3.0/9wAn82iO6baAuljoEQVoaVPuY9XDGcbcBtl8qv6StxQ.cache +1 -0
  13. data/test/dummy/tmp/cache/assets/sprockets/v3.0/HOfAHEuP6I8KPPyp98JcoOXTGi11_FBhOJwFtsevX-A.cache +1 -0
  14. data/test/dummy/tmp/cache/assets/sprockets/v3.0/HoeR2i4C0fFw3InDLqJk6bUaQeky8AuUobvnvjv6pHM.cache +0 -0
  15. data/test/dummy/tmp/cache/assets/sprockets/v3.0/ICbkYKfaoZRUPEOztDCgFmCKItizJSF6nxzG5MhlT5k.cache +0 -0
  16. data/test/dummy/tmp/cache/assets/sprockets/v3.0/JbcAACpMmVlknG104wCtLY73aNeelGB5NNPiF4uDf5s.cache +0 -0
  17. data/test/dummy/tmp/cache/assets/sprockets/v3.0/MBGxecGwxTYQEY7eD6RjPwyEK-nzQYdEg6L1CKxeNrg.cache +0 -0
  18. data/test/dummy/tmp/cache/assets/sprockets/v3.0/O8akbUwAbmIKY-AhITimq-JDQ6IgsO3Hvq2v5etufFw.cache +0 -0
  19. data/test/dummy/tmp/cache/assets/sprockets/v3.0/O_lf7JlEpHIA6lJttTUysIjiZne0WHcrriF_gfYEPuk.cache +1 -0
  20. data/test/dummy/tmp/cache/assets/sprockets/v3.0/QiWdA0USMx1DANK8U_xj8UkshlB2A5ERdXEtrOCdNgU.cache +1 -0
  21. data/test/dummy/tmp/cache/assets/sprockets/v3.0/UwMFS8rJmeOVTOPUAsy5rBsPqe-mwJgvTSCg-8xwSK8.cache +0 -0
  22. data/test/dummy/tmp/cache/assets/sprockets/v3.0/VnraCsf7KCfpeFS2tHzBzKw_a2CO0CW7p-jo_0Ov0-U.cache +0 -0
  23. data/test/dummy/tmp/cache/assets/sprockets/v3.0/X-bY_yeJIl4hwsbTN_dx12dUEzsaExaUkthjOEOBjUM.cache +0 -0
  24. data/test/dummy/tmp/cache/assets/sprockets/v3.0/Yg4blpsarsGK85xxkPyxeXWfUmlqediuIlTkheX7BH4.cache +1 -0
  25. data/test/dummy/tmp/cache/assets/sprockets/v3.0/hj8Ir9wcVSy1KYrnWu9bpD24vDhCG3tvt-nKbNxb1Wg.cache +0 -0
  26. data/test/dummy/tmp/cache/assets/sprockets/v3.0/oCsZTGZyV4kH8Y4OeSDUdrwfkJFPzTODZjuBKZB8oGQ.cache +0 -0
  27. data/test/dummy/tmp/cache/assets/sprockets/v3.0/tPF6H9NRpGO3whu2y5_e_R_1EACKdCwu5437D83qJT0.cache +0 -0
  28. data/test/helpers/clark_kent/reports_helper_test.rb +20 -0
  29. data/test/models/clark_kent/report_email_test.rb +1 -1
  30. metadata +26 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bad8b557d6a6b7c6149b375a68363a5288240cc6
4
- data.tar.gz: 7f9501da997f69055dd159907b737da46debe077
3
+ metadata.gz: fe22bd3faedb9def5b87a6d211ad636b4a19d205
4
+ data.tar.gz: d29d05f7cd1eef5d5d51ea3571a97ab214f1235e
5
5
  SHA512:
6
- metadata.gz: 859a397f8ae84eda1465d38918e51cc23af9e5b4168a9bd81f272891dd9f72ac0ea6222adf0bbb1495e3e0178fd32af813d7d8c267521bf3a22751ee40e6fa83
7
- data.tar.gz: 0d2480f4860f2f3d1b147dc22653b7d8e118347731da9bf21c639fd98eaae656f91b39a0651ec227c3032aa95e8765be75cbee8c12a69d81b42f1364c7d19a14
6
+ metadata.gz: 0a3af043dddd9aa010e65f75b9c2d4ced95a4fe36d0b7cf8df68a9568f058c2e054968872a47d65cead3fb8f30d3e507cf439c5e14d007cb257e36336bcf35e8
7
+ data.tar.gz: 7a9fb1a4648833e2e73e99692806a5b16966a786931df1c7660d8e2cc31c01b48f6c6d3b624126a85dec59a358a76e9636402be747cddf58ccf7e44dc2e9da4f
@@ -33,11 +33,20 @@ module ClarkKent
33
33
  (value =~ /\d/) && (value =~ /\./) && !(value =~ /[a-zA-Z]/)
34
34
  end
35
35
 
36
- def display_for_value(value, column=nil)
36
+ def display_for_value(value, column, row)
37
37
  ##TODO, genericize this link display. link info must come from model config.
38
38
  return link_to(value, main_app.send(column.link, id: value)) if column.try(:link) && value.present?
39
39
  return value.join(', ') if value.is_a? Array
40
40
  return value.to_formatted_s(:datepicker) if value.is_a? Date
41
+ if [DateTime,Time,ActiveSupport::TimeWithZone].any?{|k| value.class <= k}
42
+ if column.try(:time_zone_column) && row[column.time_zone_column].present?
43
+ time_zone = row[column.time_zone_column]
44
+ display_time = value.in_time_zone(time_zone)
45
+ else
46
+ display_time = value
47
+ end
48
+ return display_time.to_s(column.try :time_format)
49
+ end
41
50
  return number_to_currency(value) if value.is_a? Float or value.is_a? BigDecimal or is_decimal?(value)
42
51
  return '&#10003;'.html_safe if 't' == value or true == value
43
52
  return '' if 'f' == value or false == value
@@ -26,7 +26,7 @@ module ClarkKent
26
26
  report = ('ClarkKent::ReportEmail' == report_class.name) ? reportable.report : reportable
27
27
  query = reportable.get_query(params)
28
28
  row_count = reportable.get_query(params, true)
29
- bucket = AWS::S3::Bucket.new(ClarkKent::ReportUploaderBucketName)
29
+ bucket = Aws::S3::Bucket.new(ClarkKent::ReportUploaderBucketName)
30
30
  report_destination = bucket.objects[params[:report_result_name]]
31
31
  byte_count = 0
32
32
  temp_buffer = report.headers.to_csv
@@ -32,6 +32,14 @@ module ClarkKent
32
32
  def link
33
33
  report.column_options_for(self.name.to_sym).link
34
34
  end
35
+
36
+ def time_zone_column
37
+ report.column_options_for(self.name.to_sym).time_zone_column
38
+ end
39
+
40
+ def time_format
41
+ report.column_options_for(self.name.to_sym).time_format
42
+ end
35
43
  end
36
44
 
37
45
  class AbstractCalculator
@@ -16,7 +16,7 @@ module ClarkKent
16
16
  end
17
17
  end
18
18
  class ReportColumnConfig
19
- attr_accessor :name, :order_sql, :custom_select, :link, :summarizable, :includes, :joins, :extra_scopes, :where, :group
19
+ attr_accessor :name, :order_sql, :custom_select, :link, :time_zone_column, :time_format, :summarizable, :includes, :joins, :extra_scopes, :where, :group
20
20
  def initialize params = {}
21
21
  params.each { |key, value| send "#{key}=", value }
22
22
  end
@@ -33,7 +33,7 @@
33
33
  <% @rows.each do |row| %>
34
34
  <tr>
35
35
  <% @report.report_columns.each do |column| %>
36
- <td><%= display_for_value(row[column.column_name], column) %></td>
36
+ <td><%= display_for_value(row[column.column_name], column, row) %></td>
37
37
  <% end %>
38
38
  </tr>
39
39
  <% end %>
@@ -1,3 +1,3 @@
1
1
  module ClarkKent
2
- VERSION = "0.3.2"
2
+ VERSION = "0.4.0"
3
3
  end
Binary file