fixed nextcloud import how to step

This commit is contained in:
vabene1111
2023-06-20 16:22:02 +02:00
parent 23bfc3c3b0
commit c5eb025186

View File

@ -51,6 +51,12 @@ class NextcloudCookbook(Integration):
ingredients_added = False ingredients_added = False
for s in recipe_json['recipeInstructions']: for s in recipe_json['recipeInstructions']:
instruction_text = ''
if 'text' in s:
step = Step.objects.create(
instruction=s['text'], name=s['name'], space=self.request.space,
)
else:
step = Step.objects.create( step = Step.objects.create(
instruction=s, space=self.request.space, instruction=s, space=self.request.space,
) )
@ -102,7 +108,6 @@ class NextcloudCookbook(Integration):
m = min % 60 m = min % 60
return f'PT{h}H{m}M0S' return f'PT{h}H{m}M0S'
def get_file_from_recipe(self, recipe): def get_file_from_recipe(self, recipe):
export = {} export = {}
@ -133,7 +138,6 @@ class NextcloudCookbook(Integration):
export['recipeIngredient'] = recipeIngredient export['recipeIngredient'] = recipeIngredient
export['recipeInstructions'] = recipeInstructions export['recipeInstructions'] = recipeInstructions
return "recipe.json", json.dumps(export) return "recipe.json", json.dumps(export)
def get_files_from_recipes(self, recipes, el, cookie): def get_files_from_recipes(self, recipes, el, cookie):