Skip to content

Commit

Permalink
Merge pull request #125 from sparc-request/kg-report_date_time_zone
Browse files Browse the repository at this point in the history
KG - Time Zone in Report Date/Times
  • Loading branch information
amcates committed Feb 4, 2016
2 parents cd534be + 70c1c71 commit 1eeeae1
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 12 deletions.
1 change: 1 addition & 0 deletions app/controllers/reports_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ class ReportsController < ApplicationController

def new
@title = @report_type.titleize
@time_zone = current_identity.time_zone
end

def create
Expand Down
3 changes: 2 additions & 1 deletion app/views/reports/_auditing_report.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
#modal_errors
.row
.col-md-12
=hidden_field_tag "report_type", report_type
= hidden_field_tag "report_type", report_type
= hidden_field_tag "time_zone", time_zone
.form-group
=label_tag "title", t(:documents)[:title], class: "col-sm-3 control-label"
.col-sm-9= text_field_tag "title", title, class: "form-control"
Expand Down
2 changes: 1 addition & 1 deletion app/views/reports/_incomplete_visit_report.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#modal_errors
.row
.col-md-12
=hidden_field_tag "report_type", report_type
= hidden_field_tag "report_type", report_type
.form-group
=label_tag "title", t(:documents)[:title], class: "col-sm-3 control-label"
.col-sm-9= text_field_tag "title", title, class: "form-control"
Expand Down
1 change: 1 addition & 0 deletions app/views/reports/_invoice_report.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
.row
.col-md-12
= hidden_field_tag "report_type", report_type
= hidden_field_tag "time_zone", time_zone
.form-group
= label_tag "title", t(:documents)[:title], class: "col-sm-3 control-label"
.col-sm-9
Expand Down
3 changes: 2 additions & 1 deletion app/views/reports/_project_summary_report.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
#modal_errors
.row
.col-md-12
=hidden_field_tag "report_type", report_type
= hidden_field_tag "report_type", report_type
= hidden_field_tag "time_zone", time_zone
.form-group
=label_tag "title", t(:documents)[:title], class: "col-sm-3 control-label"
.col-sm-9= text_field_tag "title", title, class: "form-control"
Expand Down
2 changes: 1 addition & 1 deletion app/views/reports/new.js.coffee
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
$("#modal_area").html("<%= escape_javascript(render(partial: @report_type, locals: { title: @title, report_type: @report_type })) %>")
$("#modal_area").html("<%= escape_javascript(render(partial: @report_type, locals: { title: @title, report_type: @report_type, time_zone: @time_zone })) %>")
$("#modal_place").modal('show')
$('#start_date').datetimepicker(format: 'MM-DD-YYYY')
$('#end_date').datetimepicker(format: 'MM-DD-YYYY')
Expand Down
5 changes: 3 additions & 2 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 20151207203943) do
ActiveRecord::Schema.define(version: 20160120150958) do


create_table "appointment_statuses", force: :cascade do |t|
Expand Down Expand Up @@ -94,11 +94,12 @@
t.datetime "created_at"
t.datetime "updated_at"
t.string "title", limit: 255
t.string "state", limit: 255, default: "Processing"
t.string "state", limit: 255, default: "Processing"
t.datetime "last_accessed_at"
t.string "original_filename", limit: 255
t.string "content_type", limit: 255
t.string "report_type", limit: 255
t.text "stack_trace", limit: 65535
end

add_index "documents", ["documentable_id", "documentable_type"], name: "index_documents_on_documentable_id_and_documentable_type", using: :btree
Expand Down
4 changes: 2 additions & 2 deletions lib/reports/auditing_report.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ class AuditingReport < Report
require 'csv'

def generate(document)
@start_date = Time.strptime(@params[:start_date], "%m-%d-%Y")
@end_date = Time.strptime(@params[:end_date], "%m-%d-%Y")
@start_date = Time.strptime(@params[:start_date], "%m-%d-%Y").in_time_zone(@params[:time_zone])
@end_date = Time.strptime(@params[:end_date], "%m-%d-%Y").in_time_zone(@params[:time_zone])

document.update_attributes(content_type: 'text/csv', original_filename: "#{@params[:title]}.csv")

Expand Down
4 changes: 2 additions & 2 deletions lib/reports/invoice_report.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ class InvoiceReport < Report
require 'csv'

def generate(document)
@start_date = Time.strptime(@params[:start_date], "%m-%d-%Y")
@end_date = Time.strptime(@params[:end_date], "%m-%d-%Y")
@start_date = Time.strptime(@params[:start_date], "%m-%d-%Y").in_time_zone(@params[:time_zone])
@end_date = Time.strptime(@params[:end_date], "%m-%d-%Y").in_time_zone(@params[:time_zone])

document.update_attributes(content_type: 'text/csv', original_filename: "#{@params[:title]}.csv")

Expand Down
4 changes: 2 additions & 2 deletions lib/reports/project_summary_report.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ class ProjectSummaryReport < Report
require 'csv'

def generate(document)
@start_date = Time.strptime(@params[:start_date], "%m-%d-%Y")
@end_date = Time.strptime(@params[:end_date], "%m-%d-%Y")
@start_date = Time.strptime(@params[:start_date], "%m-%d-%Y").in_time_zone(@params[:time_zone])
@end_date = Time.strptime(@params[:end_date], "%m-%d-%Y").in_time_zone(@params[:time_zone])

document.update_attributes(content_type: 'text/csv', original_filename: "#{@params[:title]}.csv")

Expand Down

0 comments on commit 1eeeae1

Please sign in to comment.