Add YAML output for session slices.

This commit is contained in:
sawinglogz 2019-06-03 20:56:40 -04:00
parent 1a0a4bbf52
commit 26f6e15a75

View File

@ -182,6 +182,21 @@ void SessionToYaml(QString filepath, Session* session)
out << " start: " << ts(session->first()) << endl;
out << " end: " << ts(session->last()) << endl;
if (!session->m_slices.isEmpty()) {
out << " slices:" << endl;
for (auto & slice : session->m_slices) {
QString s;
switch (slice.status) {
case MaskOn: s = "mask on"; break;
case MaskOff: s = "mask off"; break;
case EquipmentOff: s = "equipment off"; break;
default: s = "unknown"; break;
}
out << " - status: " << s << endl;
out << " start: " << ts(slice.start) << endl;
out << " end: " << ts(slice.end) << endl;
}
}
Day day;
day.addSession(session);
out << " total_time: " << dur(day.total_time()) << endl;