Remove call to getAllInclusions when initializing tag database

This commit is contained in:
Shaun Ruffell 2019-11-28 18:00:22 -06:00 committed by lauft
parent cf8c35ad55
commit e9f860d8ce

View file

@ -28,6 +28,7 @@
#include <Database.h> #include <Database.h>
#include <format.h> #include <format.h>
#include <JSON.h> #include <JSON.h>
#include <IntervalFactory.h>
#include <iostream> #include <iostream>
#include <iomanip> #include <iomanip>
#include <shared.h> #include <shared.h>
@ -443,17 +444,17 @@ void Database::initializeTagDatabase ()
if (!File::read (_location + "/tags.data", content)) if (!File::read (_location + "/tags.data", content))
{ {
auto intervals = getAllInclusions (*this); auto it = rbegin ();
auto end = rend ();
if (intervals.empty ()) if (it == end)
{
return; return;
}
std::cout << "Tag info database does not exist. Recreating from interval data..." << std::endl ; std::cout << "Tag info database does not exist. Recreating from interval data..." << std::endl ;
for (auto& interval : intervals) for (; it != end; ++it)
{ {
Interval interval = IntervalFactory::fromSerialization (*it);
for (auto& tag : interval.tags ()) for (auto& tag : interval.tags ())
{ {
_tagInfoDatabase.incrementTag (tag); _tagInfoDatabase.incrementTag (tag);