SourceForge has been redesigned. Learn more.
Close

new Ingredient Keys not used for completion

Help
2009-02-21
2013-05-14
  • Marc Staveley

    Marc Staveley - 2009-02-21

    After adding a few recipes that had ingredients not in the standard set, I expected to be able to use them in other recipes.  But when creating a new recipe my new ingredients are not available, either to auto-complete or in the drop down for "Ingredient (key)".

    These seem to be coming from the "shopcats" table, and my new ingredients have been added to the table, but the drop down for "Ingredient (key)" does not show them.

    Or do I have this all wrong?

     
    • Marc Staveley

      Marc Staveley - 2009-02-21

      I should have said:
        gormet: 0.14.5
        Ubuntu: 8.04

       
      • tom

        tom - 2009-02-22

        It's not the shopcats table you're worried about, but this bug report makes sense inasmuch as ingredient key entry was re-implemented in 0.14.5, so it's quite likely a new bug got introduced.

        If you quit Gourmet and re-open, do your keys show up in completion? (this isn't a work around, just a diagnostic to help me zero in on the bug :)

         
    • Marc Staveley

      Marc Staveley - 2009-02-22

      Tried that but no good.  The keys don't show up even after a restart.
      If these values are not from the shopcats table where are they from?

      "Source" has a similar problem, but new sources do show up after a restart.

       
    • Marc Staveley

      Marc Staveley - 2009-02-22

      I guessing (after taking a quick look at the code) that new items will never be added to the completion list during a single run because add_ing() is commented out.

      I also can't find where add_ing_hooks[] is ever run (I'm assuming that all the code un legacy_db is not used).

      But that doesn't explain why the new keys are not showing up after a restart.  Still digging.

       
      • tom

        tom - 2009-02-22

        The ingredient keys are stored in the ingredients table.

        The shopcats table stores a list of associations:

        ingredient key -> shopping category

        The thing to look for is where the combo box in question gets its list of ingredient keys from...

        What code are you looking at where add_ing is commented out?

        OH -- and you're right -- the legacy_db stuff is all just there for updates (it's needed to read old databases so we can convert them to new databases).

         
    • Marc Staveley

      Marc Staveley - 2009-02-22

      Right,

      key_model holds the list used by the combo box.
      reccard.py:make_key_model() initializes this list from the "keylookup" table.

      neither key_model nor the "keylookup" table are updated when a new ingredient is added.

      key_model would be updated if reccard.py:add_ing() was not commented out.

      But there is no code to update the "keylookup" table so these values could be used again the next time the program is run.  A call to backends/db.py:add_ing_to_keydic() should probably be added to add_ing().

      So, I believe the fix is:
      - uncomment the code in add_ing()
      - add a call to add_ing_to_keydic() to add_ing()

      Although I am taking it on faith that add_ing() is ever run because I haven't found anywhere add_ing_hooks[] is used.

       
    • Marc Staveley

      Marc Staveley - 2009-02-22

      The bit about add_ing_to_keydic() could be wrong.

      There is a call to backends/db.py:add_ing_and_update_keydic() in reccard.py:commit_ingredients() which should do the trick, but it's not.  The keylookup table in my database does not have any of the new ingredients in it.

       
    • Marc Staveley

      Marc Staveley - 2009-02-23

      Confirmed that uncommenting the code in reccard:add_ing() causes the ingredient key auto-completion to work during a single run.

      I'm still not sure when the keylookup table gets updated.  Some of my new ingredients are there and some aren't.  The ones that don't make it don't show up in auto-completion in future runs.

      It would be nice if we had a fix_database program that can fix up the keylookup table with all the ingredients in the ingredients table.

      I may take a stab at this, but my python is rudimentary at best.

       

Log in to post a comment.