PHP (using the default PHP_ROUND_HALF_UP)
php > echo round(-1.5);"Round val up to precision decimal places away from zero, when it is half way there. Making 1.5 into 2 and -1.5 into -2."
Math.round(-1.5);"For negative numbers, if the decimal portion is exactly -0.5, the return value is the smallest integer that is greater than the number."
https://msdn.microsoft.com/en-us/library/5cza0web(v=vs.94).aspx It would be nice if there were a sqlalchemy/flask equivalent to this: https://github.com/dominno/django-moderation
The equivalent might use sqlalchemy_utils for its generic relationships: https://sqlalchemy-utils.readthedocs.io/en/latest/generic_relationship.html This was a great explanation of Modified Preorder Tree Traversal (or MPTT): https://www.sitepoint.com/hierarchical-data-database-2/
A common use-case for MPTT is categorization data, like with the way django-oscar uses django-mptt: https://github.com/django-mptt/django-mptt If you see this error in datatables: "Uncaught TypeError: Cannot read property 'style' of undefined"
It's likely that you're missing a header column in your table. Make sure you have the same number of <th> elements as items in the "columns" section of your datatables initialization. This selectize.js library looks like a good replacement for Select2: https://selectize.github.io/selectize.js/
This article has a lot of great lessons learned about timezones: http://www.creativedeletion.com/2015/01/28/falsehoods-programmers-date-time-zones.html
If your changes to a JSON, JSONB, or HSTORE field aren't saving after you commit, then you need to wrap your field in the MutableDict shown here: http://docs.sqlalchemy.org/en/latest/dialects/postgresql.html#sqlalchemy.dialects.postgresql.HSTORE This error happened because I mistyped "db.column" instead of "db.Column" when I was creating my database model using SQLAlchemy.
This might be your problem if db.create_all() isn't creating all the columns you expected. Great article about the problems with using PHP for long running processes: https://software-gunslinger.tumblr.com/post/48215406921/php-is-meant-to-die-continued
Describes the main reason why I started using Python for long-running jobs.