Here is some initial work on cleaning up the code.
| Comment | File | Size | Author |
|---|---|---|---|
| #21 | advpoll_cleanup_11.patch | 111.42 KB | ChrisKennedy |
| #20 | advpoll_cleanup_10.patch | 110.68 KB | anders.fajerson |
| #19 | advpoll_cleanup_9.patch | 110.44 KB | ChrisKennedy |
| #13 | advpoll_cleanup_8.patch | 110.38 KB | ChrisKennedy |
| #11 | advpoll_cleanup_7.patch | 109.49 KB | ChrisKennedy |
Comments
Comment #1
ChrisKennedy commentedA little bit more.
Comment #2
ChrisKennedy commentedDang, coder.module identified 8 errors that slipped by me.
Comment #3
anders.fajerson commentedLooks great!
I've always wondered about " // Load the modes in here instead of _init() toprofit from caching, ...", I saw you simply just removed it.
Moved $_make_translatable out from the loop and removed $_make_translatable.
Should "mostrecent", "maxchoices", "uselist", "showvotes" be renamed?
One liner?:
What to you say about re-ordering functions? I guess it would mess up this patch to much but is it something we want to do?
Comment #4
ChrisKennedy commentedYeah I guess we should rename the db columns. I thought about doing it last night but I ended up being too lazy.
I am fine with moving around functions; it won't mess up the patch. What did you have in mind?
Comment #5
anders.fajerson commentedMaybe it's less than I remember, but for example hook_load, hook_view, hook_delete should come after eachother. Also there is sort of a standar way for listing funcions, hook_menu, hook_perm early etc. I'll take a look at it later.
Comment #6
anders.fajerson commentedHere is a version that moves around functions a bit (mostly hook functions). Let me know what you think.
Another thing I though about was our use of "tab" in some function names. Usually "page" is used to refer to a, well..., page.
Comment #7
ChrisKennedy commentedThe function order change looks good to me. I'm ambivalent to tab vs. page - I think either one makes sense, but if page is used more often in other modules we can change it.
I did some more cleaning, removed the use of $temp, and added code to change the column and variable names that needed underscores in them. I haven't given it a full test yet but I think we're nearly done.
Comment #8
ChrisKennedy commentedOne more update - changed "mostrecent" to "latest_poll" and fixed a bug in the update function.
Comment #9
anders.fajerson commentedI did a search for "tab" in core (I wasn't sure either) and it wasn't used for function names.
Comment #10
ChrisKennedy commentedUpdated patch changes tab to page and also renames the Voting API cache variables for ranking polls.
Comment #11
ChrisKennedy commentedTwo more small errors in binary.inc.
Comment #12
anders.fajerson commentedadvpoll_form.js need to be updated to the new IDs.
Comment #13
ChrisKennedy commentedAh true.
Comment #14
anders.fajerson commentedAre you working on the update path ? ;)
Comment #15
ChrisKennedy commentedIt works fine for me... did you get an error?
Comment #16
anders.fajerson commentedSorry, I didn't bother checking the source. For some reason update_5 was taken (probably some old testing), I bumped it up to 6. Testing now.
Comment #17
ChrisKennedy commentedYeah the question patch is also using update_5() right now. Keep in mind that you can open the "Select versions" fieldset on update.php and manually change the advpoll update back to 5 for testing purposes.
Comment #18
anders.fajerson commentedYes of course, good tip. I should have read that upgrade path though, really impressive work!
Last bug?:
* Startdate turns into "1970-01-01 00:02:07 +0000" when editing a poll.
I also found that "Clear electoral list" doesn't do anything from what I can see (not caused by this patch, so it can wait).
Comment #19
ChrisKennedy commentedOops, due to a copy and paste bug start_date was a TINYINT rather than an INT. Fixed.
I did a quick separate commit to fix the electoral list reset (good catch): http://drupal.org/cvs?commit=80534
It turns out that back in May I broke that functionality by changing one of the strings but not the other: http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/advpoll/adv...
Comment #20
anders.fajerson commentedDid some changes to advpoll.install
* changed int(10) to just int
* show_votes now has NOT NULL default '1'
* changed integer to int in upgrade path
Comment #21
ChrisKennedy commentedLooks good to me & tested fine. One more fix: changed the pgsql "DEFAULT"s to default. RTBC?
Comment #22
anders.fajerson commentedRTBC :)
Comment #23
ChrisKennedy commentedPhew, biggest patch ever! Now we can actually be proud of the advpoll code. http://drupal.org/cvs?commit=80539
Comment #24
(not verified) commented