Bug 1196852

Summary: Timezone used for Report Styling is incorrect
Product: Red Hat CloudForms Management Engine Reporter: Jerome Marc <jmarc>
Component: UI - OPSAssignee: Martin Hradil <mhradil>
Status: CLOSED ERRATA QA Contact: Thom Carlin <tcarlin>
Severity: medium Docs Contact:
Priority: high    
Version: 5.3.0CC: hkataria, jhardy, mfeifer, obarenbo, tcarlin, xlecauch
Target Milestone: GA   
Target Release: 5.4.0   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: 5.4.0.0.11 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1199539 (view as bug list) Environment:
Last Closed: 2015-06-16 12:51:40 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1199539    
Attachments:
Description Flags
Contains sample report and generated outcome with issue none

Description Jerome Marc 2015-02-26 23:17:13 UTC
Created attachment 995852 [details]
Contains sample report and generated outcome with issue

Description of problem:
When using a 'if' condition to display date records of a report in a particular color (e.g. Green Background if IS today), the style is not applied based on the current date (see reports attached of a report generated on 27 Feb but date records beeing Green despite displaying 26 Feb). I believe the report style uses UTC to compare TODAY rather than the correct appliance timezone (Australia/Melbourne).

Version-Release number of selected component (if applicable):
Red Hat CloudForms 3.1
CFME 5.3.3.2.20150217120931_a465215 

How reproducible:
Always (as long as TODAY is today, the style color will change during the day as TODAY will no longer be today in the incorrect timezone :))

Steps to Reproduce:
1. Import the attached report or create a report with a style using IS TODAY
2. Generate the report and verify the output (verify date of generation vs record date and color)

Actual results:
The styling for the date record does not match the current report generation date (see attached screenshot and PDF export for example)

Expected results:
We would expect the date record styling to match the current report generation date

Additional info:

Comment 4 CFME Bot 2015-03-06 12:57:22 UTC
New commit detected on manageiq/master:
https://github.com/ManageIQ/manageiq/commit/6076bf4b90864f3d67dbbfdd78603c3075008585

commit 6076bf4b90864f3d67dbbfdd78603c3075008585
Author:     Martin Hradil <mhradil>
AuthorDate: Wed Mar 4 15:11:04 2015 +0000
Commit:     Martin Hradil <mhradil>
CommitDate: Wed Mar 4 15:14:06 2015 +0000

    Report styling should respect user's time zone
    
    MiqExpression#evaluate - added optional time zone argument (so that .to_ruby doesn't have to default to UTC in this case)
    MiqReport::Generator::Html#get_style_class gets time zone from #build_html_rows, passes it to exp.evaluate
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1196852

 vmdb/app/models/miq_expression.rb            | 8 ++++----
 vmdb/app/models/miq_report/generator/html.rb | 6 +++---
 2 files changed, 7 insertions(+), 7 deletions(-)

Comment 5 CFME Bot 2015-03-06 15:16:18 UTC
New commit detected on cfme/5.3.z:
https://code.engineering.redhat.com/gerrit/gitweb?p=cfme.git;a=commitdiff;h=10e754f91d8687bcff5130bb0fde1247fca940c9

commit 10e754f91d8687bcff5130bb0fde1247fca940c9
Author:     Martin Hradil <mhradil>
AuthorDate: Wed Mar 4 15:11:04 2015 +0000
Commit:     Martin Hradil <mhradil>
CommitDate: Fri Mar 6 15:14:49 2015 +0000

    Report styling should respect user's time zone
    
    MiqExpression#evaluate - added optional time zone argument (so that .to_ruby doesn't have to default to UTC in this case)
    MiqReport::Generator::Html#get_style_class gets time zone from #build_html_rows, passes it to exp.evaluate
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1196852
    (cherry picked from commit 6076bf4b90864f3d67dbbfdd78603c3075008585)

 vmdb/app/models/miq_expression.rb            | 8 ++++----
 vmdb/app/models/miq_report/generator/html.rb | 6 +++---
 2 files changed, 7 insertions(+), 7 deletions(-)

Comment 7 Thom Carlin 2015-03-16 20:30:02 UTC
Verified in build version 5.4.0.0.12.20150312013923_aa9b093

Comment 9 errata-xmlrpc 2015-06-16 12:51:40 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://rhn.redhat.com/errata/RHBA-2015-1100.html