lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] master 0d7d4d5 4/8: Simplify some special-case logic


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 0d7d4d5 4/8: Simplify some special-case logic to make it easier to relocate
Date: Wed, 12 Sep 2018 12:08:05 -0400 (EDT)

branch: master
commit 0d7d4d5bf7ba87daf047d220ad58147efdb5e44c
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>

    Simplify some special-case logic to make it easier to relocate
---
 ledger_pdf_generator_wx.cpp | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/ledger_pdf_generator_wx.cpp b/ledger_pdf_generator_wx.cpp
index a5ba038..4beb5d5 100644
--- a/ledger_pdf_generator_wx.cpp
+++ b/ledger_pdf_generator_wx.cpp
@@ -1420,10 +1420,17 @@ class numeric_summary_table_cell
         auto const& invar = ledger.GetLedgerInvariant();
 
         int const year_max = 
pdf_context_for_html_output.ledger().GetMaxLength();
-        int const age_last = 70;
+
+        int const summary_age = 70;
+        // Other rows are for given durations, but the
+        // last row is for a given age (typically 70).
+        std::ostringstream oss;
+        oss << "Age " << summary_age;
+        std::string const summary_age_string = oss.str();
+
         std::array<int, 4> const summary_years =
             // "- 1": 70 (e.g.) is end-of-year age.
-            {{4, 9, 19, age_last - bourn_cast<int>(invar.Age) - 1}
+            {{4, 9, 19, summary_age - bourn_cast<int>(invar.Age) - 1}
             };
         for(auto const& year : summary_years)
             {
@@ -1472,11 +1479,7 @@ class numeric_summary_table_cell
                             std::string output_value;
                             if(is_last_row && column_policy_year == j)
                                 {
-                                // Other rows are for given durations, but the
-                                // last row is for a given age (typically 70).
-                                std::ostringstream oss;
-                                oss << "Age " << age_last;
-                                output_value = oss.str();
+                                output_value = summary_age_string;
                                 }
                             else if(columns[j].variable_name.empty())
                                 {



reply via email to

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