[Rt-commit] rt branch, 4.4/dashboard-charts, updated. rt-4.4.0-112-g43f8e76

Shawn Moore shawn at bestpractical.com
Fri May 13 16:51:03 EDT 2016


The branch, 4.4/dashboard-charts has been updated
       via  43f8e76a23b5f00384032586c697d63598d53240 (commit)
      from  f75aa33c4f6be5724525931b40159595f162bc5a (commit)

Summary of changes:
 etc/upgrade/4.4.1/content | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

- Log -----------------------------------------------------------------
commit 43f8e76a23b5f00384032586c697d63598d53240
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Fri May 13 20:44:14 2016 +0000

    Upgrade step for fixing incompletely-saved charts

diff --git a/etc/upgrade/4.4.1/content b/etc/upgrade/4.4.1/content
index 61f9327..73e992b 100644
--- a/etc/upgrade/4.4.1/content
+++ b/etc/upgrade/4.4.1/content
@@ -49,5 +49,28 @@ our @Initial = (
         }
         return 1;
     },
+    # fix incompletely-saved charts
+    sub {
+        my $attrs = RT::Attributes->new(RT->SystemUser);
+        $attrs->Limit( FIELD => 'Name', VALUE => 'SavedSearch' );
+        while ( my $attr = $attrs->Next ) {
+            my $content = $attr->Content;
+
+            next unless lc($content->{SearchType}) eq 'chart';
+
+            next if $content->{ChartStyle}
+                 && $content->{GroupBy}
+                 && $content->{ChartFunction};
+
+            $content->{ChartStyle} ||= 'bar+table+sql';
+            $content->{GroupBy} ||= ['Status'];
+            $content->{ChartFunction} ||= ['COUNT'];
+
+            my ($ret, $msg) = $attr->SetContent($content);
+            unless ( $ret ) {
+                RT->Logger->error("Failed to update chart for SavedSearch #" . $attr->id . ": $msg");
+            }
+        }
+    },
 );
 

-----------------------------------------------------------------------


More information about the rt-commit mailing list