This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class PurchaseOrderSerializer(NestedSerializerMixin): | |
lines = PoLineSerializer(many=True, required=False) | |
class Meta: | |
model = PurchaseOrder | |
fields = '__all__' | |
class PoLineSerializer(serializers.ModelSerializer): | |
id = serializers.IntegerField(required=False) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
def calc_tick(rp): | |
# P = 1.0001 ^ i | |
# sqrt(P) = 1.0001 ^ (i / 2) | |
# i = log(sqrt(P)) * 2 / log(1.0001) | |
return (math.log(rp) * 2) / math.log(1.0001) |