The ratings in the nodeapi example module don't keep up with the revisioning system. Meaning: The rating stays the same regardless of new ratings for new node revisions. This might also be the case for the 7.x branch, but I have no way to test it at the moment.
A code-filled half-hour after discovering this, I have it fixed and would offer a patch, but I'm not comfortable enough with those tools to do it. Any link to a helpful cheat sheet would be appreciated.
As a side note, this patch might be a good example of how to do a schema update, as well. :-)
Comments
Comment #1
rfayHi @Mile23! Fantastic. Your contribution is much appreciated.
http://drupal.org/patch is the place to start with patches.
Since you're the contributing sort, it's worth your time to learn how to do it.
However, if you just can't, post an archive of some type and I'll extract the patch from it. Again, though, learning this process makes you so much more powerful as a contributor.
Thanks!
-Randy
Comment #2
mile23Thanks much, Randy. I just learned how to get all diff'd -up.
Now we try this and see...
Comment #3
rfayTo get your patch tested, then you put the status as "needs review"
Note that the whole thing goes into one patch (both changes). This may not pass the tests because it's going to test each one separately.
Congrats on getting patching going!
Comment #4
mile23Thanks again, Randy. Seems I passed. woot. :-)
Comment #5
rfayThanks for the good work. This looks OK to me.
However, we *really* need tests for this module. It's one of the few without tests. You code like you know how to do tests.... Any interest?
Comment #6
rfayOK, I finally took the time to look at this carefully.
The real issue this patch is trying to address is that the rating is not kept with the revision, which, it's true, is correct. The purpose of this example is to demonstrate how to use the node APIs, and where the rating is stored is not all that relevant to it, but I agree that the fix you propose is much better.
However, new revisions are not "lost" - the most recent revision set on a node is the one that's kept.
Problems running the update hook - probably due to adding new column (with an index) while the old one is still there.
or as drush shows it:
Comment #7
ilo commentedlet me check..
Comment #8
ilo commentedI'm not happy including an update function in the example module as it may lead to confusion unless the purpose of the module is to perform an update operation, so I'll forget that part and focus on the revision system only. I've included a testcase for the revision stuff, now rating is saved between revisions as expected.
Lets review this and I'll backport the changes to d6.
Comment #9
ilo commentedChanged to a better description of the issue.
Comment #10
ilo commentedAfter an irc convo with chx and rfay, probably this module needs to be refactored at all to support fields, instead of using its own database tables.. so, rfay, you choose: mark as rtbc and commit, and then we work on a rewrite, or mark as needs work and we begin the field implementation.. :)
Comment #11
rfay#8: examples-nodeapi-example-revisions-829536.patch queued for re-testing.
Comment #12
rfayTook a look at this on the plane today, and I think we should go with it. I'm wide open to new examples that demonstrate fields, but this one has a lot of work done on it and we should get it in.
Comment #13
rfayCommitted: http://drupal.org/cvs?commit=462276
Comment #14
rfayAnd should this be backported to D6?
Comment #15
mile23Wow, I hadn't looked at this in far too long. Yay committed for D7. :-)
I'll revisit my patch so that it changes the schema without creating an update, even though of course that's not good behavior for any other module.
Comment #16
mile23OK, basically the same patch, without an update function, for D6.
Comment #18
rfay@Mile23, you forgot the --no-prefix in your git diff
git diff --no-prefix DRUPAL-6--1 (or whatever)
That said, I have had a LOT of trouble getting the testbot successful in the last couple of days. However, your patch is in fact faulty. So maybe it will get through when rerolled.
Attached is a straight reroll.
Comment #20
mile23Heh. You give me too much credit to say I *forgot* the --no-prefix. :-)
However... Let's see how this works.
Comment #21
rfayI don't actually understand what's going on with this "Drupal installation failed" thing.
Comment #22
mile23It installs just fine for me on drupal 6.19.
Comment #24
mile23I wonder if it's perhaps trying to install the module 'examples.'
Comment #25
rfayI'll track it down. It may be that all D6 contrib testing is failing.
Comment #26
rfay@Mile23, I just noticed that the tests from D7 didn't make it into your patch. Could you fix up the tests and include them?
(Don't worry about the testbot failures. Until we get that working again we'll have to go by manual testing.)
Comment #27
mile23Sure, why not. :-) #997682: D6 NodeAPI Example Needs Test
Comment #28
mile23Voila.
Comment #29
rfayCommitted:
http://drupal.org/cvs?commit=467394
and http://drupal.org/cvs?commit=467396
Thanks so much, @Mile23. You really hung with this one! You're welcome anywhere here in the Examples project and your contribution is very much appreciated.