HTML generator: Sort by date.
continuous-integration/drone/push Build is passing Details

This commit is contained in:
tastytea 2020-07-05 08:11:59 +02:00
parent 2e164316dd
commit cfb79577ae
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
1 changed files with 7 additions and 0 deletions

View File

@ -19,6 +19,7 @@
#include "json.hpp"
#include "types.hpp"
#include <algorithm>
#include <cstdint>
#include <cstdlib>
#include <fstream>
@ -32,6 +33,7 @@ namespace FediBlock::files
using std::getenv;
using std::ifstream;
using std::runtime_error;
using std::sort;
using std::string;
using std::stringstream;
using std::uintmax_t;
@ -138,6 +140,11 @@ vector<entry_type> read_json_files()
entries.push_back(entry);
}
// clang-format off
sort(entries.begin(), entries.end(), [](const auto &a, const auto &b)
{ return a.report_time > b.report_time; }); // Newest first.
// clang-format on
return entries;
}