Skip to content

Commit

Permalink
fix(moneymanagerex#5111): omit if no assets
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Whalley committed Sep 22, 2022
1 parent 8b26907 commit 6f9f15c
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/mmhomepage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,13 @@ htmlWidgetGrandTotals::~htmlWidgetGrandTotals()

const wxString htmlWidgetAssets::getHTMLText()
{
const int MAX_ASSETS = 10;
Model_Asset::Data_Set assets = Model_Asset::instance().all();
if (assets.empty())
return wxEmptyString;
std::stable_sort(assets.begin(), assets.end(), SorterByVALUE());
std::reverse(assets.begin(), assets.end());

static const int MAX_ASSETS = 10;
wxString output = "";
output = R"(<div class="shadow">)";
output += "<table class ='sortable table'><col style='width: 50%'><col style='width: 25%'><col style='width: 25%'><thead><tr class='active'>\n";
Expand All @@ -588,10 +594,6 @@ const wxString htmlWidgetAssets::getHTMLText()
, "ASSETS", "ASSETS", "ASSETS");
output += "</tr></thead><tbody id='ASSETS'>\n";

Model_Asset::Data_Set assets = Model_Asset::instance().all();
std::stable_sort(assets.begin(), assets.end(), SorterByVALUE());
std::reverse(assets.begin(), assets.end());

int rows = 0;
double initialDisplayed = 0.0;
double initialTotal = 0.0;
Expand Down

0 comments on commit 6f9f15c

Please sign in to comment.