Hi.

This module was working fine. It had been some time since anyone had added a recipe, but people have tried recently. The "yield" field is not saved, nor are the "instructions".

I am using the most recent version of the module.

mrweaver

Comments

mattrweaver’s picture

Hello?

marble’s picture

Hi,

Are you still on drupal 5.x? I have committed a fix to CVS HEAD, but can apply it to the 5.x branch too if you need it.

Sorry about the delay.

mattrweaver’s picture

Yep still on 5. Thanks

mrweaver

mattrweaver’s picture

I have upgraded to 6 and still, the yield field is not being saved. Others appear to have versions where the value is saved. Which versions work and which don't?

What's crazy is, when this module used to work, saving yields, etc., those old recipes work. Is there a conflict with a module or something, or some Drupal update since an early D5 version of the module that somehow changed?

jvandervort’s picture

Yield in the recipe edit screen saves properly for me. Yield in the recipe summary box for on-the-fly calculations doesn't save.
Which one are you referring to? And how should it work?

mattrweaver’s picture

When I add a new recipe, or try to edit one, I enter the yield field, but the data is not saved. However, for the first recipes I entered, the yield field is saved. For earlier recipes, the yield number appears when I am looking at a node, and the double/halve buttons work just fine.

I have the latest version of the module. Should I completely uninstall the module, remove the tables, try reinstalling from scratch and then importing my old recipes into the database?

mrweaver

scottprive’s picture

Version: 5.x-1.0 » 6.x-1.x-dev
Assigned: Unassigned » scottprive

Hi mrweaver,

Just to confirm, you are saying:

For old recipes where Yield was already known to have been saved correctly (meaning they have been viewed before), those recipes continue to display a Yield OK.

But... when you edit the recipe, the new yield does not save.
And, when you enter a brand new recipe now, Yield is also blank (even though you saved something)?
Let me know please so I can be sure what this is, thanks.

FYI-
I just tried editing, changing 5 to 6 on a Yield, it saves and displays fine. this was a recipe I created in the CVS-HEAD version under D6.

So I am not sure what is going on... but I suspect as you suspect, it could be something that only happened with upgrades.

You can try what you suggest, or you could fix this in the database directly if you have a way to edit the rows in Recipe (changing the value in recipe.yield). One of these methods will be easier for you than the other...

If you do upgrade, I would suggest doing a CVS pull against HEAD as that's what I can confirm is OK. (Perhaps this is also OK in 1.0-beta1, but I can not confirm that. )

The CVS code is development, but very stable as a new release is in the works and close to release.

mattrweaver’s picture

Editing the yield field for an old recipe (where the yield was saved) works.

Looking at a test recipe that I created, the "instructions" field has been wiped out (I may have seen that behavior before, it's been a while since I've looked at this module).

Just tried the development version, and editing old recipe doesn't work. However, entering new recipes saves the yield data and instructions, however I got two error messages, one each for the second and third ingredients:
I had entered: "1 pound bacon" and "1 pint sausage gravy." On account of these errors, the ingredients are not saved.

* user warning: Incorrect integer value: '' for column 'link' at row 1 query: INSERT INTO recipe_ingredient (name, link) VALUES ('bacon', '') in C:\Program Files\Apache2.2\htdocs\bts\sites\all\modules\recipe\recipe.module on line 583.

* user warning: Incorrect integer value: '' for column 'link' at row 1 query: INSERT INTO recipe_ingredient (name, link) VALUES ('sausage gravy', '') in C:\Program Files\Apache2.2\htdocs\bts\sites\all\modules\recipe\recipe.module on line 583.

mattrweaver’s picture

Just tried the latest development release. The test recipe had 4 ingredients. It saved three and gave me this on the fouth:

user warning: Incorrect integer value: '' for column 'link' at row 1 query: INSERT INTO recipe_ingredient (name, link) VALUES ('pepper', '') in C:\Program Files\Apache2.2\htdocs\bts\sites\all\modules\recipe\recipe.module on line 583.

Ingredients and yield were saved.

I have tried to go back and edit the old recipes but cannot get yield and instructions to save.

I looked in the recipe database and found that the nodes for these affected recipes do not appear in the recipe table.

The older recipes are there, and so are the couple of test recipes that I've entered since upgrading to D6. But those recipes where the yield/instructions aren't saved aren't there.

the nodes for these recipes are _not_ in the recipe_node_ingredient table, however.

jvandervort’s picture

Committed fix for "Incorrect integer value" in 6.x-dev. We'll see if you can save again.

jvandervort’s picture

Also, if you haven't, make sure to run update.php

scottprive’s picture

Cool. So I guess at some point this got checked in against some older branch but not against HEAD. Hope this is the only one like that. :-)

mattrweaver’s picture

I ran update.php and instructions and ingredients now get saved! Huzzah!

But I'm curious why older recipes still suffer the problem after the upgrade? I can't edit them.

scottprive’s picture

mrweaver,

Would you be able to do a database dump of your recipe tables?
I'm guessing that somewhere along the way compatibility broke, but I don't know that to be the case.

Also, if those recipes were edited or created in "Simple" mode there are a number of data corruption issues. Be sure you do not allow Simple mode to be used (you can disable it in Recipe Admin). Simple will be removed soon.

mattrweaver’s picture

StatusFileSize
new5.35 KB

The dump file is attached. I have not set the module to "simple". You will see that some recipes have been entered strictly for testing purposes and contain entries written when slap-happy. Enjoy.

Thanks for your help.

mrweaver

jvandervort’s picture

StatusFileSize
new1.46 KB

Yep, definitely some table differences with the current format.

Attached is the current schema.

Here are the diffs I can see:

recipe table:
nid field need to be auto_increment (You may have duplicates in this field in the data)
yield field needs to be int(11)

recipe_node_ingredient table:
unit_id int(10) UNSIGNED
quantity float

recipe_unit table:
id int(10) UNSIGNED auto_increment
name varchar(255) NULL=Yes Default=NULL
abbreviation varchar(8) NULL=Yes Default=NULL
metric int(10) UNSIGNED NULL=No Default=0
type varchar(6) NULL=No Default=Mass

scottprive’s picture

Hmm.

I think this has happened to others not just mrweaver as evidenced by some Issues. So even if he is willing to forget it and recreate these recipes in the new database, there maybe be are other folks who are in a worse scenario.

Basically I am not too comfortable with DB repair. I was hoping it was something else. :-)

I could script alter the old tables to match our current no problem, except..
.. I'm not sure that in of itself is all that is required to fix this.
.. I'm not sure if that alter would need to be put into the .install script for all previous-version upgrades or selectively applied.

John do you have any ideas or want to claim this one?

mattrweaver’s picture

I don't really have that many recipes, as you can see. I have this on an intranet. But, if I insert the recipe data into tables created with the new schema, will that work, or do I have to manually enter the data?

mrweaver

jvandervort’s picture

I added a new update.php handler this morning. If you get a new dev copy tonight,
you can re-run update.php. You'll have to manually choose Recipe - 6000 from the pulldown.
There should be one error on update, but that is OK.

mattrweaver’s picture

Is this the one error?

Update #6100

* Failed: ALTER TABLE {recipe_node_ingredient} ADD `weight` INT NOT NULL DEFAULT 0

I edited an old recipe and the ingredients did save, but yield and instructions still did not.

jvandervort’s picture

Yep, that's the one error.
If you can dump your 4 recipes tables again, I could check them against 6.x and see if we are there.
Once we can verify the database, we should at least be a step closer. I wish we were getting some error messages.

scottprive’s picture

There might also be some PHP errors recorded in Reports>Recent Log Entries..

mattrweaver’s picture

StatusFileSize
new5.52 KB

Here you go.

jvandervort’s picture

The tables are exactly correct. Also, I just made a change to the recipe update function. Let's see if that does it.
It should be in tonight's dev snapshot(Feb10).

mattrweaver’s picture

Update #6100

* Failed: ALTER TABLE {recipe_node_ingredient} ADD `weight` INT NOT NULL DEFAULT 0

user warning: Duplicate column name 'weight' query: ALTER TABLE recipe_node_ingredient ADD `weight` INT NOT NULL DEFAULT 0 in C:\Program Files\Apache2.2\htdocs\bts\includes\database.mysql-common.inc on line 298.

Yield and instructions do not save.

jvandervort’s picture

The Feb 10 nightly snapshot hasn't been generated yet:)

Currently it's still:
6.x-1.x-dev Download (37.88 KB) 2010-Feb-09

mattrweaver’s picture

scottprive’s picture

Assigned: scottprive » jvandervort
mattrweaver’s picture

I downloaded the most recent one (got my date right, this time!) and still, when I edit a recipe whose yield and instructions have not saved, they still don't save.

jvandervort’s picture

Which recipe or node id is it?

jvandervort’s picture

StatusFileSize
new47.7 KB

I think I found it! No really:) I think so...

Give this a try.

mattrweaver’s picture

chicken waldorff salad, node/911

jvandervort’s picture

Yep, node 911 does not have an entry in the recipe table.
The fix in #31 above should handle that.

mattrweaver’s picture

You got it! I will edit my other recipes, but suffice to say, chicken waldorff salad is a go!

jvandervort’s picture

Status: Active » Fixed

Committed the fix. It should show up in the 6.x-1.x-dev snapshot dated Feb12.
Thanks for posting back so often on this issue. It really helps resolve these hard to duplicate problems.

mattrweaver’s picture

No worries, glad i could help. I'm happy to have this working again.

scottprive’s picture

Thanks for chasing this down John..

Status: Fixed » Closed (fixed)

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