Ingredients do not resort when weights are changed or rows are dragged.

Code problem is in function recipe_ingredient_autocomplete_validate:

    // Try to find an iid with a name matching the entered ingredient name.
    // recipe_ingredient_id_from_name() creates the ingredient if not found.
    $value = array(
      'quantity' => $element['quantity']['#value'],
      'unit_key' => $element['unit_key']['#value'],
      'iid' => recipe_ingredient_id_from_name($name),
      'name' => $name,
      'note' => $element['note']['#value'],
      '_weight' => $element['_weight']['#value'],              <= this is missing
    );

If someone can help me out with the procedure for correcting (github pull request, patch creation) I can help out.

CommentFileSizeAuthor
#3 2605148-3.patch398 bytesdcam

Comments

tim_wgbh created an issue. See original summary.

tim_wgbh’s picture

Issue summary: View changes
dcam’s picture

Status: Active » Needs review
Issue tags: -ingredients, -ordering, -weights
StatusFileSize
new398 bytes

Thanks for offering to write a patch, but I took care of it. Also, thanks for the report. I guess I thought that the Field API would take care of the weights. Clearly I haven't done a lot of ingredient re-ordering.

I'm going to let Testbot check the patch, then I'll commit it. I don't expect there to be any errors. I really should write a test for this, but I'm feeling lazy.

  • dcam committed 5197dce on 7.x-2.x authored by tim_wgbh
    Issue #2605148 by tim_wgbh: Ingredient ordering broken
    
dcam’s picture

Status: Needs review » Fixed

I committed the patch. I gave you the commit credit, @tim_wgbh.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.