Announcement

Collapse
No announcement yet.

Recommendation for another field in the item database

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Recommendation for another field in the item database

    It would seem useful to have a flag added to each item that indicates if that item is an ingredient in a recipe. It's been about two decades since I've dealt with databases, but it'd seem fairly easy to do a globally set the flags to false, then search of all recipies records and for each ingredient set that item's flag to true.

    Then when you display the page for an item, if that flag is true include the 'Find recipes that use this item', otherwise print a little message indicating the item isn't used in any known recipies.
    -- Mewkus: 2100 dings on the server formerly known as Solusek Ro
    try: Inventory/Flags/Spells tracker program - (sample output)

  • #2
    But that would mean every time an item is added, there would be aditional scanns to make sure the flag is set for each sub-component

    I will still think about it though.
    Ngreth Thergn

    Ngreth nice Ogre. Ngreth not eat you. Well.... Ngreth not eat you if you still wiggle!
    Grandmaster Smith 250
    Master Tailor 200
    Ogres not dumb - we not lose entire city to froggies

    Comment


    • #3
      when new items are added, the flag just defaults to false. when new recipes are added, just have it scan through the ingredients (on just that recipe) and for each item have it go set it's flag.

      Like i said, im not a database guy, but i would think there'd be a come kind of macro/app run whenever a recipe changes or gets added. The catch is when an ingredient is removed from a recipe, you'd have to go though all the recipes to see if it's used in another.

      An option that could bypass the checking after items are removed a recipe would be to have this new field be an int instead of boolean and have it be a count of how many recipes it's used in. Can cap it at 255 if making it a single byte ends up being more optimum. Then when an ingredient is removed from a recipe, it just decrements that number.

      To handle any sync issues, have some kind of a scheduled batch job to do a full scan of all the recipes once a day or so.
      -- Mewkus: 2100 dings on the server formerly known as Solusek Ro
      try: Inventory/Flags/Spells tracker program - (sample output)

      Comment


      • #4
        Mewkus, what would be the benefit? For now, you can see if it is a component in a recipe by clicking the "Find recipes that use this item" link. What would you gain from adding this field?

        Comment


        • #5
          One would know if it's a component without having to click the Find Recipes button. Since there would be no Find Recipe button for items that aren't used in recipes, it'd reduce the searches through the database when someone clicks the Find Recipes button for items that aren't used in recipes.
          -- Mewkus: 2100 dings on the server formerly known as Solusek Ro
          try: Inventory/Flags/Spells tracker program - (sample output)

          Comment

          Working...
          X