plugins
plugins copied to clipboard
database: Increase duration of previous db entry when deleting
The database plugin provides the possibility to manually delete single entries in the DB via the plugin's web interface (dustbin button). The value itself is delete correctly. However, the duration of the previous value should be increased by the same duration of the item that is deleted.
At the moment, using the manual delete button leads to a currpted database in which the durations are no longer consistent. This leads to wrong values when evaluating integral values from the db entries.
Since the deleted value is not equal to the previous entry, wouldn‘t it be incorrect to increase the duration? It would imply that the previous value was valid for a longer time than it realy was.
I get your point. But from my understanding, the db concept does not support invalid values. In addition, the purpose of the calculated duration for every db entry is not to mark the validity of the entry. The duration is there to calculate integral values, determin "device on" times, etc. My conclusion is that the sum of all db durations in a certain time span should always reflect the time span itself. That's why I suggest to extend the duration of the previous duration upon deletion. In my opinion, it is wrong to manually delete a db entry without fixing the consistency of the duration.