Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

database: Increase duration of previous db entry when deleting #714

Open
aschwith opened this issue Mar 15, 2023 · 2 comments
Open

database: Increase duration of previous db entry when deleting #714

aschwith opened this issue Mar 15, 2023 · 2 comments

Comments

@aschwith
Copy link
Contributor

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.

@msinn
Copy link
Member

msinn commented Aug 29, 2023

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.

@msinn msinn changed the title Database plugin: Increase duration of previous db entry when deleting database: Increase duration of previous db entry when deleting Aug 29, 2023
@aschwith
Copy link
Contributor Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants