mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-02 06:35:52 +08:00
Ref T310, added model statistics dialog
* UI for statistics * renamed to "coverageSummaryForModel" * model list "htmlStatistics"
This commit is contained in:
@@ -47,6 +47,30 @@ namespace BlackMisc
|
||||
return this->container().findFirstByOrDefault(&OBJ::getDbKey, key, notFound);
|
||||
}
|
||||
|
||||
template<class OBJ, class CONTAINER, typename KEYTYPE>
|
||||
CONTAINER IDatastoreObjectList<OBJ, CONTAINER, KEYTYPE>::findObjectsWithDbKey() const
|
||||
{
|
||||
CONTAINER objects;
|
||||
for (const OBJ &obj : ITimestampObjectList<OBJ, CONTAINER>::container())
|
||||
{
|
||||
if (!obj.hasValidDbKey()) { continue; }
|
||||
objects.push_back(obj);
|
||||
}
|
||||
return objects;
|
||||
}
|
||||
|
||||
template<class OBJ, class CONTAINER, typename KEYTYPE>
|
||||
CONTAINER IDatastoreObjectList<OBJ, CONTAINER, KEYTYPE>::findObjectsWithoutDbKey() const
|
||||
{
|
||||
CONTAINER objects;
|
||||
for (const OBJ &obj : ITimestampObjectList<OBJ, CONTAINER>::container())
|
||||
{
|
||||
if (obj.hasValidDbKey()) { continue; }
|
||||
objects.push_back(obj);
|
||||
}
|
||||
return objects;
|
||||
}
|
||||
|
||||
template <class OBJ, class CONTAINER, typename KEYTYPE>
|
||||
OBJ IDatastoreObjectList<OBJ, CONTAINER, KEYTYPE>::maxKeyObject() const
|
||||
{
|
||||
@@ -139,8 +163,8 @@ namespace BlackMisc
|
||||
if (keys.contains(obj.getDbKey())) { continue; }
|
||||
newValues.push_back(obj);
|
||||
}
|
||||
int delta = this->container().size() - newValues.size();
|
||||
this->container() = newValues;
|
||||
const int delta = this->container().size() - newValues.size();
|
||||
if (delta > 0) { this->container() = newValues; }
|
||||
return delta;
|
||||
}
|
||||
|
||||
@@ -197,6 +221,16 @@ namespace BlackMisc
|
||||
return count;
|
||||
}
|
||||
|
||||
template<class OBJ, class CONTAINER, typename KEYTYPE>
|
||||
bool IDatastoreObjectList<OBJ, CONTAINER, KEYTYPE>::containsAnyObjectWithoutKey() const
|
||||
{
|
||||
for (const OBJ &obj : ITimestampObjectList<OBJ, CONTAINER>::container())
|
||||
{
|
||||
if (!obj.hasValidDbKey()) { return true; }
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
template<class OBJ, class CONTAINER, typename KEYTYPE>
|
||||
CONTAINER IDatastoreObjectList<OBJ, CONTAINER, KEYTYPE>::fromMultipleJsonFormats(const QJsonObject &jsonObject)
|
||||
{
|
||||
|
||||
@@ -30,6 +30,12 @@ namespace BlackMisc
|
||||
//! Object with key, notFound otherwise
|
||||
OBJ findByKey(KEYTYPE key, const OBJ ¬Found = OBJ()) const;
|
||||
|
||||
//! Objects with DB key
|
||||
CONTAINER findObjectsWithDbKey() const;
|
||||
|
||||
//! Objects without DB key
|
||||
CONTAINER findObjectsWithoutDbKey() const;
|
||||
|
||||
//! Object with max.key
|
||||
OBJ maxKeyObject() const;
|
||||
|
||||
@@ -66,6 +72,9 @@ namespace BlackMisc
|
||||
//! Number of entries with valid DB key
|
||||
int countWithValidDbKey() const;
|
||||
|
||||
//! Any object without key?
|
||||
bool containsAnyObjectWithoutKey() const;
|
||||
|
||||
//! From multiple JSON formats
|
||||
//! \remark supports native swift C++ format, DB format, and cache format
|
||||
static CONTAINER fromMultipleJsonFormats(const QJsonObject &jsonObject);
|
||||
|
||||
Reference in New Issue
Block a user