084c78e2cd
I have no idea why we do this in the database as some magic after we call save(). I also have no idea why MySQL is seeming to think we want type BIGINT UNSIGNED at the end of the ((2 * '+2' + '+1') - ( '-1' + 2 * '-2')) but it does. Setting it to 2.0 or float(2) doesn't get the ORM to get this right, but we are going to Decimal and making the 2 multiplier be of type Decimal manages to make the ORM pull it's shit together and use something that seems like we're okay with. +1, -2 = 1 / 2 = -0.5 Score == True Looks like it works. UPDATE `symposion_reviews_proposalresult` SET `score` = CASE WHEN `symposion_reviews_proposalresult`.`vote_count` = 0 THEN '0' ELSE ((((2 * `symposion_reviews_proposalresult`.`plus_two`) + `symposion_reviews_proposalresult`.`plus_one`) - (`symposion_reviews_proposalresult`.`minus_one` + (2 * `symposion_reviews_proposalresult`.`minus_two`))) / (`symposion_reviews_proposalresult`.`vote_count` * 1)) END WHERE `symposion_reviews_proposalresult`.`id` = 1 |
||
---|---|---|
.. | ||
management | ||
migrations | ||
templatetags | ||
__init__.py | ||
admin.py | ||
apps.py | ||
context_processors.py | ||
forms.py | ||
models.py | ||
urls.py | ||
utils.py | ||
views.py |