update_features: Fix update flag if hashes match #31
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
@Zverik @hixi thanks for the great tool!
I am pretty sure this is a bug. Since I'm using the tool for not so long, I am happy about a second pair of eyes/opinion on this. Maybe my usage is wrong, in uploading a Changes-JSON without a audit file, but my intention is to override only the changed features.
User-wise
The commit fixes the following case of updating features: You are uploading a set of features (Changes-JSON), where a ref exists, with a corresponding Feature object in the database
feat.audit
data (and not data is in the Audit-File as well)So at the moment all Feature related Task objects are deleted and the validates_count of the Feature is reset, despite the object contents are the same.
Technically
The change is pretty obvious.
If the computed content hash matches, update is set to True, despite that no update is needed. So I fix this, in setting this to
False
instead. It now prevents the reset ofvalidates_count
of database-features (that are the same in the set of upload-features) in the following line:cf_audit/www/util.py
Line 65 in 1089ad5
Alternatively you could remove the whole code line, since it's value is already initialized as
False
.