* @brief Counts non-numeric samples per dataset and stores them on each DatasetStats row. */
| 158 | * @brief Counts non-numeric samples per dataset and stores them on each DatasetStats row. |
| 159 | */ |
| 160 | static 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. |
no test coverage detected