The actual final value is 30. What I think is happening is that CQLEngine applies all values of the counters as increments. Thus, when you do "setattr", if you use the current value of the counter, it treats it as a increment for the full value.
start: instance.counter = 0
instance.counter += 3 # current actual value is 3
save() # CQLEngine increment by 3
instance.counter += 7 # current actual value is 10
save() # CQLEngine increment by 10, CQL value is 13
instance.counter += 7 # current actual value is 17
save() # CQLEngine increment by 17, CQL value is 30.
The problem is that when the "_dirties" are applied to the CQLEngine instance during save, it's using the full value of the counter column. It seems that CQLEngine implicitly converts this to an increment by that full value.
I added a counter test for this scenario. Here's the core of it:
The actual final value is 30. What I think is happening is that CQLEngine applies all values of the counters as increments. Thus, when you do "setattr", if you use the current value of the counter, it treats it as a increment for the full value.
start: instance.counter = 0
The problem is that when the "_dirties" are applied to the CQLEngine instance during save, it's using the full value of the counter column. It seems that CQLEngine implicitly converts this to an increment by that full value.