MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / loadStringSampleCounts

Function loadStringSampleCounts

app/src/Sessions/ReportData.cpp:160–177  ·  view source on GitHub ↗

* @brief Counts non-numeric samples per dataset and stores them on each DatasetStats row. */

Source from the content-addressed store, hash-verified

158 * @brief Counts non-numeric samples per dataset and stores them on each DatasetStats row.
159 */
160static void loadStringSampleCounts(QSqlDatabase& db,
161 int sessionId,
162 std::vector<Sessions::DatasetStats>& datasets)
163{
164 QSqlQuery strQ(db);
165 strQ.prepare("SELECT unique_id, COUNT(*) FROM readings "
166 "WHERE session_id = ? AND is_numeric = 0 GROUP BY unique_id");
167 strQ.bindValue(0, sessionId);
168 if (!strQ.exec())
169 return;
170
171 while (strQ.next()) {
172 const int uid = strQ.value(0).toInt();
173 auto it = findDatasetByUid(datasets, uid);
174 if (it != datasets.end())
175 it->stringSamples = strQ.value(1).toLongLong();
176 }
177}
178
179/**
180 * @brief Loads the first or last numeric value per dataset; ties broken by reading_id.

Callers 1

buildFromSessionMethod · 0.85

Calls 4

findDatasetByUidFunction · 0.85
execMethod · 0.80
nextMethod · 0.80
valueMethod · 0.45

Tested by

no test coverage detected