Bug 1743535 - Incorrect timezone shown in the Data View of a saved report
Summary: Incorrect timezone shown in the Data View of a saved report
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: Reporting
Version: 5.11.0
Hardware: Unspecified
OS: Unspecified
medium
high
Target Milestone: GA
: 5.11.5
Assignee: drew uhlmann
QA Contact: Parthvi Vala
Red Hat CloudForms Documentation
URL:
Whiteboard:
Depends On:
Blocks: 1761516
TreeView+ depends on / blocked
 
Reported: 2019-08-20 08:05 UTC by Parthvi Vala
Modified: 2020-05-05 13:43 UTC (History)
4 users (show)

Fixed In Version: 5.11.5.0
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1761516 (view as bug list)
Environment:
Last Closed: 2020-05-05 13:43:09 UTC
Category: Bug
Cloudforms Team: CFME Core
Target Upstream Version:
Embargoed:
pm-rhel: cfme-5.11.z+
mfeifer: mirror+


Attachments (Terms of Use)
Bug Demo (730.85 KB, video/webm)
2019-08-20 08:05 UTC, Parthvi Vala
no flags Details
imezones (9.89 MB, text/plain)
2019-09-03 14:20 UTC, Yuri Rudman
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2020:2020 0 None None None 2020-05-05 13:43:21 UTC

Description Parthvi Vala 2019-08-20 08:05:55 UTC
Created attachment 1606012 [details]
Bug Demo

Description of problem:
Timezone shown in the data view of a saved report is incorrect.

Version-Release number of selected component (if applicable):
5.11.0.19

How reproducible:
Always

Steps to Reproduce:
1. Navigate to My Settings and change the timezone to something other than UTC
2. Create a report based on `VMs and Instances`, and fields - name, boot time
3. Queue the report
4. Observe the timezone in the report data
5. Navigate to the data view of the queued report and observe the timezone in the report data.

Actual results:
1.
2.
3.
4. Timezone will be as set in step 1.
5. Timezone is set to UTC.

Expected results:
1.
2.
3.
4.
5. Timezone must be the same as set in step 1.

Additional info:
Related BZ - https://bugzilla.redhat.com/show_bug.cgi?id=1599849

Comment 2 Yuri Rudman 2019-08-30 16:07:08 UTC
Already generated reports should not changed timezone, It is working as designed.

Comment 3 Parthvi Vala 2019-09-03 06:40:34 UTC
Hi Yuri,

I think you've misunderstood. I first changed the timezone and then queued/generated the report. In that case, it should definitely show the changed timezone.
I can see the expected timezone in the queued report in normal view, but not when I switch the view to Data view. I think that is a bug.

Let me know what you think.

Thanks,
Parthvi

Comment 4 Yuri Rudman 2019-09-03 14:20:58 UTC
Created attachment 1611194 [details]
imezones

Comment 5 Yuri Rudman 2019-09-03 14:21:59 UTC
I was testing on latest code from master - attached timezone.mov:
There are 3 reports generated for user with different timezones: JST, HST, UTC. Current timezone is JST (as shown on tree view)
Default timezone (saved in report) correctly displayed when report is loading.
Applying filter is changing report's view to show current timezone  instead of saved. It all looks fine to me

Comment 8 drew uhlmann 2019-09-10 18:58:25 UTC
  def format_row(row, allowed_columns = nil, expand_value_format = nil)
    @tz ||= get_time_zone(Time.zone)
    $log.info("XXX with #{@tz.inspect}")
    row.map do |key, _|
      value = allowed_columns.nil? || allowed_columns&.include?(key) ? format_column(key, row, @tz, col_format_hash[key]) : row[key]
      [key, expand_value_format.present? ? { :value => value, :style_class => get_style_class(key, row, @tz) } : value]
    end.to_h
  end

https://github.com/ManageIQ/manageiq/blob/master/app/models/miq_report.rb#L286

That's returning UTC after having been set to a different time in the settings.

Comment 9 drew uhlmann 2019-09-11 11:03:39 UTC
Hey Parthvi, could you take another look at that appliance and let me know if the code that's currently running on it is more in line with how this should be working, please?

Comment 10 Parthvi Vala 2019-09-11 11:48:51 UTC
Um, it is on the lines of it, but not exactly. I changed the timezone and generated the report again, it didn't show current timezone in the data view, but the last timezone(MDT) that was set.

Comment 12 CFME Bot 2019-09-16 16:35:53 UTC
New commit detected on ManageIQ/manageiq/master:

https://github.com/ManageIQ/manageiq/commit/03dc3ff4ddd516ff06891bbca9c3bc9fa6a774f0
commit 03dc3ff4ddd516ff06891bbca9c3bc9fa6a774f0
Author:     d-m-u <drewuhlmann>
AuthorDate: Wed Sep 11 08:32:45 2019 -0400
Commit:     d-m-u <drewuhlmann>
CommitDate: Wed Sep 11 08:32:45 2019 -0400

    Use the user timezone rather than the report timezone for display

    Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1743535

 app/models/miq_report.rb | 6 +-
 spec/models/miq_report_spec.rb | 28 +
 2 files changed, 31 insertions(+), 3 deletions(-)

Comment 15 CFME Bot 2020-03-26 15:20:15 UTC
New commit detected on ManageIQ/manageiq/ivanchuk:

https://github.com/ManageIQ/manageiq/commit/f5ec1bf7d2a356ab0a56864cb3187031d4716cba
commit f5ec1bf7d2a356ab0a56864cb3187031d4716cba
Author:     Gregg Tanzillo <gtanzill>
AuthorDate: Mon Sep 16 16:31:37 2019 +0000
Commit:     Gregg Tanzillo <gtanzill>
CommitDate: Mon Sep 16 16:31:37 2019 +0000

    Merge pull request #19285 from d-m-u/fixing_timezone_on_reports

    Check for user timezone on report first for display formatting

    (cherry picked from commit ec4833e22465fd2555ec9e44f8e4550f22dba729)

    https://bugzilla.redhat.com/show_bug.cgi?id=1743535

 app/models/miq_report.rb | 6 +-
 spec/models/miq_report_spec.rb | 28 +
 2 files changed, 31 insertions(+), 3 deletions(-)

Comment 16 Parthvi Vala 2020-04-16 11:32:56 UTC
FIXED. Verified on 5.11.5.1.

Comment 19 errata-xmlrpc 2020-05-05 13:43:09 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2020:2020


Note You need to log in before you can comment on or make changes to this bug.