Commit ef4a1771 authored by Volker Krause's avatar Volker Krause
Browse files

Pick a better modification time for pkpass content if we have one

The "relevant date" property isn't ideal for that, as it is unreliably
filled and even when set correctly refers to the time of the booked event
rather than the booking time. That's still useful for context, but for
modification time (which we need for proper update handling), the
surrounding document can be more useful.
parent 83fedaff
......@@ -345,8 +345,13 @@ void PkPassDocumentProcessor::postExtract(ExtractorDocumentNode &node) const
auto result = node.result().jsonLdResult();
for (auto resV : result) {
auto res = resV.toObject();
res.insert(QStringLiteral("pkpassPassTypeIdentifier"), pass->passTypeIdentifier());
res.insert(QStringLiteral("pkpassSerialNumber"), pass->serialNumber());
res.insert(QLatin1String("pkpassPassTypeIdentifier"), pass->passTypeIdentifier());
res.insert(QLatin1String("pkpassSerialNumber"), pass->serialNumber());
// pass->relevantDate() as modification time is inherently unreliable (it wont change most of the time)
// so if we have something from an enclosing document, that's probably better
if (node.parent().contextDateTime().isValid()) {
res.insert(QLatin1String("modifiedTime"), node.parent().contextDateTime().toString(Qt::ISODate));
}
resV = res;
}
node.setResult(result);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment