lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] (no subject)


From: Greg Chicares
Subject: [lmi-commits] (no subject)
Date: Thu, 2 Jun 2016 15:01:43 +0000 (UTC)

branch: master
commit 0a0b58859623c8bfd03fc31ec022b2e9ce2499ae
Author: Gregory W. Chicares <address@hidden>
Date:   Thu Jun 2 15:00:41 2016 +0000

    Consolidate calculation-summary column-selection diagnostics
    
    As the c98ef204a3c4bed96fc98f3aa2cbef7691c3200d commit message noted,
    diagnostics were curiously divided, so they were given under different
    circumstances. Now they're combined, and given in more cases. An empty
    column selection is a silly user error, for which repeated warnings
    are well justified.
    
    Because warnings are now given more frequently, the GUI test
      ./wx_test.exe --data_path=/opt/lmi/data --test calculation_summary
    no longer succeeds. It seems best to finish pending changes to the
    Preferences dialog before modifying 'wx_test_calculation_summary.cpp'.
---
 configurable_settings.cpp |   24 ++++++++++++++++++++----
 preferences_model.cpp     |   10 +---------
 2 files changed, 21 insertions(+), 13 deletions(-)

diff --git a/configurable_settings.cpp b/configurable_settings.cpp
index a5a7d47..1730afc 100644
--- a/configurable_settings.cpp
+++ b/configurable_settings.cpp
@@ -434,7 +434,10 @@ std::string const& configurable_settings::xsl_fo_command() 
const
 
 namespace
 {
-std::vector<std::string> parse_calculation_summary_columns(std::string const& 
s)
+std::vector<std::string> parse_calculation_summary_columns
+    (std::string const& s
+    ,bool               use_builtin_calculation_summary
+    )
 {
     std::istringstream iss(s);
     std::vector<std::string> const& allowable = 
all_strings<mcenum_report_column>();
@@ -457,6 +460,15 @@ std::vector<std::string> 
parse_calculation_summary_columns(std::string const& s)
                 ;
             }
         }
+
+    if(columns.empty() && !use_builtin_calculation_summary)
+        {
+        warning()
+            << "Calculation summary will be empty: no columns chosen."
+            << LMI_FLUSH
+            ;
+        }
+
     return columns;
 }
 } // Unnamed namespace.
@@ -464,7 +476,10 @@ std::vector<std::string> 
parse_calculation_summary_columns(std::string const& s)
 std::vector<std::string> input_calculation_summary_columns()
 {
     configurable_settings const& z = configurable_settings::instance();
-    return parse_calculation_summary_columns(z.calculation_summary_columns());
+    return parse_calculation_summary_columns
+        (z.calculation_summary_columns()
+        ,z.use_builtin_calculation_summary()
+        );
 }
 
 std::vector<std::string> effective_calculation_summary_columns()
@@ -472,8 +487,9 @@ std::vector<std::string> 
effective_calculation_summary_columns()
     configurable_settings const& z = configurable_settings::instance();
     return parse_calculation_summary_columns
         (z.use_builtin_calculation_summary()
-        ? default_calculation_summary_columns()
-        : z.calculation_summary_columns()
+            ? default_calculation_summary_columns()
+            : z.calculation_summary_columns()
+        ,z.use_builtin_calculation_summary()
         );
 }
 
diff --git a/preferences_model.cpp b/preferences_model.cpp
index 1bf7809..8f09d7e 100644
--- a/preferences_model.cpp
+++ b/preferences_model.cpp
@@ -267,15 +267,7 @@ void PreferencesModel::Save() const
 {
     configurable_settings& z = configurable_settings::instance();
 
-    std::string s(string_of_column_names());
-    if(s.empty() && "Yes" != UseBuiltinCalculationSummary)
-        {
-        warning()
-            << "Calculation summary will be empty: no columns chosen."
-            << LMI_FLUSH
-            ;
-        }
-    z["calculation_summary_columns"    ] = s;
+    z["calculation_summary_columns"    ] = string_of_column_names();
     z["use_builtin_calculation_summary"] = value_cast<std::string>("Yes" == 
UseBuiltinCalculationSummary);
     z["skin_filename"                  ] = SkinFileName.value();
 }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]