here’s a code snippet of the problem
#multiplication works fine
drivers.annotate(
completed_orders_percentage=( Count('orders', filter=Q(orders__rejected=False), distinct=True) * Count('orders', distinct=True) ) * 100 ,
)
#addition works fine
drivers.annotate(
completed_orders_percentage=( Count('orders', filter=Q(orders__rejected=False), distinct=True) + Count('orders', distinct=True) ) * 100 ,
)
#subtraction works fine
drivers.annotate(
completed_orders_percentage=( Count('orders', filter=Q(orders__rejected=False), distinct=True) - Count('orders', distinct=True) ) * 100 ,
)
#diving not working (returns 0)
drivers.annotate(
completed_orders_percentage=( Count('orders', filter=Q(orders__rejected=False), distinct=True) / Count('orders', distinct=True) ) * 100 ,
)
i couldnt find anything useful in the docs, i thought that it might be due to type of the return so i tried to wrappe it in ExeprisionWrapper with output_field=FloatField() but still the same!