Compare commits

..

3 Commits

Author SHA1 Message Date
vabene1111
e727cae020 fixed typo that broke fractions 2021-02-18 09:17:42 +01:00
vabene1111
894d2d2e6b gracful recipes api error on wrong format of update_at 2021-02-16 22:14:40 +01:00
vabene1111
543e52d596 updated preview image 2021-02-15 22:05:04 +01:00
7 changed files with 8 additions and 6 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -9,7 +9,7 @@ from annoying.functions import get_object_or_None
from django.contrib import messages
from django.contrib.auth.models import User
from django.core import management
from django.core.exceptions import FieldError
from django.core.exceptions import FieldError, ValidationError
from django.core.files import File
from django.db.models import Q
from django.http import FileResponse, HttpResponse, JsonResponse
@@ -70,6 +70,8 @@ class StandardFilterMixin(ViewSetMixin):
queryset = queryset.filter(updated_at__gte=updated_at)
except FieldError:
pass
except ValidationError:
raise APIException(_('Parameter updated_at incorrectly formatted'))
limit = self.request.query_params.get('limit', None)
random = self.request.query_params.get('random', False)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 MiB

After

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

View File

@@ -12,7 +12,7 @@
<i class="far fa-check-circle text-primary" v-if="!ingredient.checked"></i>
</td>
<td>
<span v-if="ingredient.amount !== 0">{{ calculateAmount(ingredient.amount) }}</span>
<span v-if="ingredient.amount !== 0" v-html="calculateAmount(ingredient.amount)"></span>
</td>
<td>
<span v-if="ingredient.unit !== null && !ingredient.no_amount">{{ ingredient.unit.name }}</span>

View File

@@ -78,9 +78,9 @@ export function getUserPreference(pref) {
import {frac} from "@/utils/fractions";
export function calculateAmount(amount, factor) {
if (getUserPreference('user_fractions')) {
if (getUserPreference('use_fractions')) {
let return_string = ''
let fraction = frac.cont((amount * factor), 9, true)
let fraction = frac((amount * factor), 9, true)
if (fraction[0] > 0) {
return_string += fraction[0]