diff --git a/cookbook/helper/recipe_url_import.py b/cookbook/helper/recipe_url_import.py index e76d12e8..df24409a 100644 --- a/cookbook/helper/recipe_url_import.py +++ b/cookbook/helper/recipe_url_import.py @@ -2,13 +2,11 @@ import random import re from isodate import parse_duration as iso_parse_duration from isodate.isoerror import ISO8601Error -from recipe_scrapers._exceptions import ElementNotFoundInHtml from cookbook.helper.ingredient_parser import parse as parse_single_ingredient from cookbook.models import Keyword from django.utils.dateparse import parse_duration from html import unescape -from recipe_scrapers._schemaorg import SchemaOrgException from recipe_scrapers._utils import get_minutes @@ -56,6 +54,7 @@ def get_from_scraper(scrape, space): recipe_json['cookTime'] = get_minutes(scrape.schema.data.get("cookTime")) or 0 except Exception: recipe_json['cookTime'] = 0 + if recipe_json['cookTime'] + recipe_json['prepTime'] == 0: try: recipe_json['prepTime'] = get_minutes(scrape.total_time()) or 0 diff --git a/cookbook/managers.py b/cookbook/managers.py index c5ba3cb3..20cdb261 100644 --- a/cookbook/managers.py +++ b/cookbook/managers.py @@ -53,7 +53,7 @@ class RecipeSearchManager(models.Manager): .annotate( search=search_vectors, rank=search_rank, - #trigram=trigram_name+trigram_description+trigram_food+trigram_keyword + # trigram=trigram_name+trigram_description+trigram_food+trigram_keyword # trigram_name=trigram_name, # trigram_description=trigram_description, # trigram_food=trigram_food, diff --git a/cookbook/migrations/0121_auto_20210518_1638.py b/cookbook/migrations/0121_auto_20210518_1638.py index 678bfd36..a67fc933 100644 --- a/cookbook/migrations/0121_auto_20210518_1638.py +++ b/cookbook/migrations/0121_auto_20210518_1638.py @@ -18,6 +18,6 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='userpreference', name='use_fractions', - field=models.BooleanField(default=False), + field=models.BooleanField(default=True), ), ] diff --git a/cookbook/migrations/0120_build_full_text_index.py b/cookbook/migrations/0122_build_full_text_index.py similarity index 96% rename from cookbook/migrations/0120_build_full_text_index.py rename to cookbook/migrations/0122_build_full_text_index.py index c1a4301a..f1d84d0d 100644 --- a/cookbook/migrations/0120_build_full_text_index.py +++ b/cookbook/migrations/0122_build_full_text_index.py @@ -19,7 +19,7 @@ def set_default_search_vector(apps, schema_editor): class Migration(migrations.Migration): dependencies = [ - ('cookbook', '0119_auto_20210411_2101'), + ('cookbook', '0121_auto_20210518_1638'), ] operations = [ migrations.AddField( diff --git a/cookbook/templates/url_import.html b/cookbook/templates/url_import.html index 7254839f..4e7cf997 100644 --- a/cookbook/templates/url_import.html +++ b/cookbook/templates/url_import.html @@ -29,7 +29,7 @@ style="height:50%" href="{% bookmarklet request %}" title="{% trans 'Drag me to your bookmarks to import recipes from anywhere' %}"> - {% trans 'Bookmark Me!' %} + {% trans 'Bookmark Me!' %}