cookbook icon indicating copy to clipboard operation
cookbook copied to clipboard

Number of categories differs between the GUI and the API

Open j0hannesr0th opened this issue 1 year ago • 8 comments

Description

The total count of categories presented in the GUI significantly varies when compared to what is available through the API.

Reproduction Steps to reproduce the behavior:

  1. Add many recipes
  2. Compare the numbers

Expected behavior The numbers should be the same.

Actual behavior The numbers are different. The numbers shown in the GUI are correct. The API numbers are wrong.

Screenshots

API
[
    {
        "name": "Asia",
        "recipe_count": 18
    },
    {
        "name": "Beilagen",
        "recipe_count": 12
    },
    {
        "name": "Braten",
        "recipe_count": 2
    },
    {
        "name": "Brotzeit",
        "recipe_count": 6
    },
    {
        "name": "Cocktails",
        "recipe_count": 2
    },
    {
        "name": "Dessert",
        "recipe_count": 42
    },
    {
        "name": "Dünsten",
        "recipe_count": 2
    },
    {
        "name": "Eis",
        "recipe_count": 8
    },
    {
        "name": "Fisch",
        "recipe_count": 26
    },
    {
        "name": "Fleisch",
        "recipe_count": 28
    },
    {
        "name": "Gebäck",
        "recipe_count": 12
    },
    {
        "name": "Gemüse",
        "recipe_count": 2
    },
    {
        "name": "Getränke",
        "recipe_count": 6
    },
    {
        "name": "Grillen",
        "recipe_count": 24
    },
    {
        "name": "Hauptgericht",
        "recipe_count": 40
    },
    {
        "name": "Kuchen",
        "recipe_count": 55
    },
    {
        "name": "Muffins",
        "recipe_count": 14
    },
    {
        "name": "Salate",
        "recipe_count": 20
    },
    {
        "name": "Schnelle Küche",
        "recipe_count": 2
    },
    {
        "name": "Soße",
        "recipe_count": 2
    },
    {
        "name": "Suppe",
        "recipe_count": 8
    },
    {
        "name": "Torten",
        "recipe_count": 38
    },
    {
        "name": "Veggie",
        "recipe_count": 14
    },
    {
        "name": "Vorspeise",
        "recipe_count": 12
    },
    {
        "name": "*",
        "recipe_count": 1
    }
]
GUI

image

Browser Chrome 123.0

Versions Nextcloud server version: 28.0.3 Cookbook version: 0.11.0 Database system: MariaDB

j0hannesr0th avatar Mar 28 '24 15:03 j0hannesr0th

Hello I also have this bug. Number differrent between the app cookbook and the nextcloud GUI. It seem's the error is in NC ans not the API / app IOS. Capture d’écran 2024-09-09 à 21 32 25 The picture show a number to19 in todo and we can count only 16 receip

Browser Firefox

Versions Nextcloud server version: 29.0.6 Cookbook version: 0.11.1

ewok2 avatar Sep 09 '24 19:09 ewok2

OK, this sounds strange lik the DB had some broken entries. I have multiple ideas how to proceed here:

  1. Can anyone share their set of recipes (just zip the recipes folder in files app) here where the problem exists? I would like to import and see if I can reproduce.
  2. Do you have (direct) DB access? Then, we could have a look at the tables which indicate the categories. I can give/build the SQL commands to get more information if anyone is capable to execute these directly.

christianlupus avatar Sep 15 '24 20:09 christianlupus

This evening I can zip the directory reciepe and send it to you (but it is 160 Mb befor zip) And it is also possible for me to be in command line on the server with the possibility to log in maria DB, but my knowledge in SQL are very tiny ;-)

ewok2 avatar Sep 16 '24 05:09 ewok2

Hello The zip zile is 160Mb... And download is possible there : https://nextcloud.schugart.net/s/M986rRaiJsYL2re

ewok2 avatar Sep 16 '24 19:09 ewok2

I tried downloading the zip file but it seems broken... I have a MD5 of 7acecec7ec0458d205d402012e9983cc. Is this true? Can you please check if the file can be unzipped by you?

christianlupus avatar Sep 17 '24 16:09 christianlupus

Sorry the file was indeed broken (it had only 50Mb and not the 160,5Mb) Know it should works I have tested the download and unzip and it is Ok

ewok2 avatar Sep 17 '24 20:09 ewok2

Hmm, with the latest NC 31 (dev) version and the master branch, I cannot reproduce the problem. I put all 164 recipes (thanks for sharing :wink:) into the instance and it detected all. The categories are assigned correctly.

I am still thinking on what the problem might be. I am considering some weird effect that the import just got broken in some way and the updating algorithm is written such that existing recipes are not readded once in the database cache. There are ways to solve this but I want to avoid big changed that are to be thrown away soon...

christianlupus avatar Sep 20 '24 09:09 christianlupus

NC30 is already available (for stable branch)? Did not sdee it... -> I will update

I was wondering if this behaviour is not because I use a "non standard way" to clone some reciepe... For example I add a cake with raspberry, and I want to change raspberry with peach. so I copy / paste in the file file browser. Change the name of the directory and edit the "new" receip with NC Cookbook app. This behavior had maybe put a strange thing in the database if it see once the same ID in the Json?

In any case this behaviour is not a problem for me :-) As soon as you get many reciepe you stop counting them ...

ewok2 avatar Sep 21 '24 09:09 ewok2