Skip to content

Commit

Permalink
Merge pull request #5119 from whalley/master
Browse files Browse the repository at this point in the history
fix(#5111): omit if no assets
  • Loading branch information
whalley committed Sep 22, 2022
2 parents 8b26907 + 6f9f15c commit b647e45
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 b647e45

Please sign in to comment.