recipe editor decimal fixes
This commit is contained in:
@ -496,6 +496,11 @@ class StepRecipeSerializer(WritableNestedModelSerializer):
|
|||||||
|
|
||||||
|
|
||||||
class NutritionInformationSerializer(serializers.ModelSerializer):
|
class NutritionInformationSerializer(serializers.ModelSerializer):
|
||||||
|
carbohydrates = CustomDecimalField()
|
||||||
|
fats = CustomDecimalField()
|
||||||
|
proteins = CustomDecimalField()
|
||||||
|
calories = CustomDecimalField()
|
||||||
|
|
||||||
|
|
||||||
def create(self, validated_data):
|
def create(self, validated_data):
|
||||||
validated_data['space'] = self.context['request'].space
|
validated_data['space'] = self.context['request'].space
|
||||||
|
@ -586,6 +586,8 @@ export default {
|
|||||||
if (this.recipe.working_time === "" || isNaN(this.recipe.working_time)) {
|
if (this.recipe.working_time === "" || isNaN(this.recipe.working_time)) {
|
||||||
this.recipe.working_time = 0
|
this.recipe.working_time = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.recipe.servings = Math.floor(this.recipe.servings) // temporary fix until a proper framework for frontend input validation is established
|
||||||
if (this.recipe.servings === "" || isNaN(this.recipe.servings)) {
|
if (this.recipe.servings === "" || isNaN(this.recipe.servings)) {
|
||||||
this.recipe.servings = 0
|
this.recipe.servings = 0
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user