Error and fix (diff)

Posts from previous Beta sessions

Error and fix (diff)

Postby trelis » Sat Dec 04, 2010 10:17 am

Wowroster SVN 2215

Error Description: When clicking the next button in the Member log I get a bunch of the below errors.

page: /roster/index.php?p=guild-memberslist-log&a=g:1&alts=ungroup&st=25

Error Info:
Code: Select all
PHP Errors
addons/memberslist/inc/memberslist.php
  Notice line 402: Undefined index: main_id
  Notice line 411: Undefined index: main_id
  Notice line 402: Undefined index: main_id
  Notice line 411: Undefined index: main_id
  Notice line 402: Undefined index: main_id
  Notice line 411: Undefined index: main_id
  Notice line 402: Undefined index: main_id
  Notice line 411: Undefined index: main_id
  Notice line 402: Undefined index: main_id
  Notice line 411: Undefined index: main_id
  Notice line 402: Undefined index: main_id
  Notice line 411: Undefined index: main_id
  Notice line 402: Undefined index: main_id
  Notice line 411: Undefined index: main_id
  Notice line 402: Undefined index: main_id
  Notice line 411: Undefined index: main_id
  Notice line 402: Undefined index: main_id
  Notice line 411: Undefined index: main_id
  Notice line 402: Undefined index: main_id
  Notice line 411: Undefined index: main_id
  Notice line 402: Undefined index: main_id
  Notice line 411: Undefined index: main_id
  Notice line 402: Undefined index: main_id
  Notice line 411: Undefined index: main_id
  Notice line 402: Undefined index: main_id
  Notice line 411: Undefined index: main_id
  Notice line 402: Undefined index: main_id
  Notice line 411: Undefined index: main_id
  Notice line 402: Undefined index: main_id
  Notice line 411: Undefined index: main_id
  Notice line 402: Undefined index: main_id
  Notice line 411: Undefined index: main_id
  Notice line 402: Undefined index: main_id
  Notice line 411: Undefined index: main_id
  Notice line 402: Undefined index: main_id
  Notice line 411: Undefined index: main_id


Suggestions:
The fix is the following:

Code: Select all
Index: addons/memberslist/guild/log.php
===================================================================
--- addons/memberslist/guild/log.php    (revision 2215)
+++ addons/memberslist/guild/log.php    (working copy)
@@ -23,7 +23,8 @@
        'SELECT *, DATE_FORMAT( `update_time`, "' . $roster->locale->act['timeformat'] . '" ) AS date, '.
        "IF( `members`.`note` IS NULL OR `members`.`note` = '', 1, 0 ) AS 'nisnull', ".
        'UNIX_TIMESTAMP(`update_time`) AS date_stamp '.
-       'FROM `'.$roster->db->table('memberlog').'` AS members ';
+       'FROM `'.$roster->db->table('memberlog').'` AS members '.
+       'LEFT JOIN `'.$roster->db->table('alts',$addon['basename']).'` AS alts ON `members`.`member_id` = `alts`.`member_id` ';
 $where[] = '`guild_id` = "'.$roster->data['guild_id'].'"';
 $order_last[] = '`date_stamp` DESC';
Last edited by trelis on Sat Dec 04, 2010 11:06 am, edited 1 time in total.
trelis
WR.net Apprentice
WR.net Apprentice
 
Posts: 19
Joined: Fri Nov 26, 2010 1:14 pm

Re: Error and fix (diff)

Postby PleegWat » Sat Dec 04, 2010 10:32 am

Does that work? IIRC the alts table only contains current members, not past ones. It's been a while since I last looked at that code though. I don't think it should be showing alts on the memberlog page at all.
I <3 /bin/bash
User avatar
PleegWat
WoWRoster.net Dev Team
WoWRoster.net Dev Team
 
Posts: 1636
Joined: Tue Jul 04, 2006 1:43 pm

Re: Error and fix (diff)

Postby trelis » Sat Dec 04, 2010 10:52 am

PleegWat wrote:Does that work? IIRC the alts table only contains current members, not past ones. It's been a while since I last looked at that code though. I don't think it should be showing alts on the memberlog page at all.


It uses it for the open/close alts buttons at the top.

In SQL a LEFT JOIN only adds data, it doesn't remove any. In the case of LEFT any rows that exist in the left table but not the right are included, rows that only exist in the right table are not added. So if there is a row in the alt list that doesn't exist in the memberlog it isn't added. So the past members will have that field "NULL" while current members will have it filled out.

I think you are thinking of an "INNER JOIN" (or just JOIN as inner is the default), which would only provide data that is present in both tables.

It does fix it for me. There is still no previous button after you hit next, but that's a different bug and that doesn't produce errors at least.
trelis
WR.net Apprentice
WR.net Apprentice
 
Posts: 19
Joined: Fri Nov 26, 2010 1:14 pm

Re: Error and fix (diff)

Postby PleegWat » Mon Dec 06, 2010 3:30 pm

Both sound like issues which need to be fixed in the backend class. The missing previous button definitely sound like a bug.

When I said 'does that work', I mainly meant the PHP end. The memberslist class matches up alts with their mains in memory. I'm not sure what it does if a character has a NULL main.
Additionally, since the alts are processed in memory, and I'm 99% sure from memory that pagination is handled in SQL, you'd run into mainless alt situations where the main is on a different page.


Anyway, can someone add this fix to SVN? I don't have it set up at the moment, so I won't be writing a fix myself anytime soon. IIRC there is also a memberslog page on realm level - that one will need the same patch.
I <3 /bin/bash
User avatar
PleegWat
WoWRoster.net Dev Team
WoWRoster.net Dev Team
 
Posts: 1636
Joined: Tue Jul 04, 2006 1:43 pm

Re: Error and fix (diff)

Postby zanix » Mon Dec 06, 2010 9:10 pm

Sure, I will add this when I can

EDIT: Added to the SVN
The pagination seems like it doesn't work though, and when hitting the next-prev buttons, the page loads with the default realm, even if another realm is selected
Read the Forum Rules, the WiKi, and Search before posting!
WoWRoster v2.1 - SigGen v0.3.3.523 - WoWRosterDF
User avatar
zanix
Admin
Admin
WoWRoster.net Dev Team
WoWRoster.net Dev Team
UA/UU Developer
UA/UU Developer
 
Posts: 5546
Joined: Mon Jul 03, 2006 8:29 am
Location: Idaho Falls, Idaho
Realm: Doomhammer (PvE) - US

Re: Error and fix (diff)

Postby PleegWat » Tue Dec 07, 2010 12:39 am

Definitely something messy in the memberslist class. Gonna have to make myself look into it...

Also, on rereading, is there word subsitution going on here? I'm positive I did not write 'PHP end'. Since they're both PHP ends.
I <3 /bin/bash
User avatar
PleegWat
WoWRoster.net Dev Team
WoWRoster.net Dev Team
 
Posts: 1636
Joined: Tue Jul 04, 2006 1:43 pm

Re: Error and fix (diff)

Postby zanix » Tue Dec 07, 2010 5:52 am

Not that I know of...
Read the Forum Rules, the WiKi, and Search before posting!
WoWRoster v2.1 - SigGen v0.3.3.523 - WoWRosterDF
User avatar
zanix
Admin
Admin
WoWRoster.net Dev Team
WoWRoster.net Dev Team
UA/UU Developer
UA/UU Developer
 
Posts: 5546
Joined: Mon Jul 03, 2006 8:29 am
Location: Idaho Falls, Idaho
Realm: Doomhammer (PvE) - US


Return to Archived

Who is online

Users browsing this forum: No registered users and 1 guest

cron