Features/Spent Times: Difference between revisions
| Line 24: | Line 24: | ||
Each journal object will contain an array for spent times, for each time the entry was launch. This created a 1-to-1 relation between spent times and the current launches times. This way, the entry metadata can reflect not only "when" but also "for how long". | Each journal object will contain an array for spent times, for each time the entry was launch. This created a 1-to-1 relation between spent times and the current launches times. This way, the entry metadata can reflect not only "when" but also "for how long". | ||
== How to access this metadata == | |||
from sugar3.datastore import datastore | |||
entries, count = datastore.find(self._query()) | |||
for entry in entries: | |||
raw_data = entry.metadata.get('spent-times', None) | |||
if raw_data is not None: | |||
spent_times = map(int, raw_data.split(', ')) | |||
== Benefit to Sugar == | == Benefit to Sugar == | ||