Comments

ChrisKennedy’s picture

StatusFileSize
new47.05 KB

A little bit more.

ChrisKennedy’s picture

StatusFileSize
new49.72 KB

Dang, coder.module identified 8 errors that slipped by me.

anders.fajerson’s picture

StatusFileSize
new71.3 KB

Looks 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?:

    if ($vote->uid == 0) {
      // Anonymous user.
      $key = $vote->hostname;
    }
    else {
      // Logged-in user.
      $key = $vote->uid;
    }

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?

ChrisKennedy’s picture

Status: Needs review » Needs work

Yeah 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?

anders.fajerson’s picture

Maybe 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.

anders.fajerson’s picture

StatusFileSize
new88.55 KB

Here 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.

ChrisKennedy’s picture

Status: Needs work » Needs review
StatusFileSize
new105.27 KB

The 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.

ChrisKennedy’s picture

StatusFileSize
new106.22 KB

One more update - changed "mostrecent" to "latest_poll" and fixed a bug in the update function.

anders.fajerson’s picture

I did a search for "tab" in core (I wasn't sure either) and it wasn't used for function names.

ChrisKennedy’s picture

StatusFileSize
new108.52 KB

Updated patch changes tab to page and also renames the Voting API cache variables for ranking polls.

ChrisKennedy’s picture

StatusFileSize
new109.49 KB

Two more small errors in binary.inc.

anders.fajerson’s picture

Status: Needs review » Needs work

advpoll_form.js need to be updated to the new IDs.

ChrisKennedy’s picture

Status: Needs work » Needs review
StatusFileSize
new110.38 KB

Ah true.

anders.fajerson’s picture

Status: Needs review » Needs work

Are you working on the update path ? ;)

ChrisKennedy’s picture

It works fine for me... did you get an error?

anders.fajerson’s picture

Status: Needs work » Needs review

Sorry, 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.

ChrisKennedy’s picture

Yeah 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.

anders.fajerson’s picture

Status: Needs review » Needs work

Yes 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).

ChrisKennedy’s picture

Status: Needs work » Needs review
StatusFileSize
new110.44 KB

Oops, 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...

anders.fajerson’s picture

StatusFileSize
new110.68 KB

Did 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

ChrisKennedy’s picture

StatusFileSize
new111.42 KB

Looks good to me & tested fine. One more fix: changed the pgsql "DEFAULT"s to default. RTBC?

anders.fajerson’s picture

Status: Needs review » Reviewed & tested by the community

RTBC :)

ChrisKennedy’s picture

Status: Reviewed & tested by the community » Fixed

Phew, biggest patch ever! Now we can actually be proud of the advpoll code. http://drupal.org/cvs?commit=80539

Anonymous’s picture

Status: Fixed » Closed (fixed)