Notifications
Clear all

"Stories by" counting number of stories co-authored instead of total stories

27 Posts
11 Users
0 Reactions
9,011 Views
(@rhapsody)
Posts: 31
Eminent Member
 

Nopes 3.3.1. Works like a charm. We upgraded from 3.3.1 to 3.4.2 and that's when the errors came up. So previous version for us would be 3.3.1.


 
Posted : 17/06/2008 9:25 am
(@julieann)
Posts: 60
Trusted Member
 

I just finished upgrading to 3.4.3 this weekend. In the testing I've done so far the Co-author/Storycount issue seems to be fixed. Horrah!


Julieann

Running 3.4.3 bridged with SMF and Coppermine
Mods: Challenges, cpg-art (not working), Limit Summary Length, Bio to Prefs, Top 20 instead of 10
Wants: Move Betareader to Prefs, Twitter
Gatchaman Fanfic Archive

 
Posted : 28/06/2008 5:36 pm
(@sacrilege)
Posts: 0
 

We recently upgraded to 3.4.3 - around mid-June - and have just received reports of this problem on our site as well.  Recalculating stories and site stats does not make any difference, the count for an author remains at 1 (the co-authored amount) even though she has lots of fics posted.


 
Posted : 03/07/2008 3:40 am
(@marauder-by-midnight)
Posts: 56
Trusted Member
Topic starter
 

Yes, this error definitely still exists with 3.4.3.

This story is my example. All the coauthors are listed now, but go to this user's profile, and you'll see that she has the co-authored story listed 5 times (her story count is 6 because she has co-authored another story). Go to this person's profile and you'll see that she has only one story listed when in reality she has 8 stories, including the co-authored one.

I've manually changed their numbers, but it's only a temporary solution. When they edit a story or submit a new story, the count reverts back to the number of stories coauthored, not authored total.


 
Posted : 14/07/2008 9:45 am
 Foz
(@foz)
Posts: 16
Active Member
 

Just found this error and it's a simple fix:

In admin/maintenance.php

else if($maint == "stories") {
$authors = dbquery("SELECT uid, count(uid) AS count FROM ".TABLEPREFIX."fanfiction_stories WHERE validated > 0 GROUP BY uid");
while($a = dbassoc($authors)) {
$alist[$a['uid']] = $a['count'];
}
$coauthors = dbquery("SELECT uid, count(sid) AS count FROM ".TABLEPREFIX."fanfiction_coauthors GROUP BY uid");
while($ca = dbassoc($coauthors)) {
if(in_array($ca['uid'], $alist)) $alist[$ca['uid']] = $alist[$ca['uid']] + $ca['count'];
else $alist[$ca['uid']] = $ca['count'];
}
foreach($alist AS $a => $s) {
dbquery("UPDATE ".TABLEPREFIX."fanfiction_authorprefs SET stories = '$s' WHERE uid = '$a' LIMIT 1");
}
$output .= write_message(_ACTIONSUCCESSFUL);
}

The problem is with the adding of co author stories, for some reason in_array() is being used to try and determine if the uid key is in the list, but in_array is only for checking a value in an array, not a key!

If I change:

			if(in_array($ca['uid'], $alist)) $alist[$ca['uid']] = $alist[$ca['uid']] + $ca['count'];
else $alist[$ca['uid']] = $ca['count'];

to:

$alist[$ca['uid']] = $alist[$ca['uid']] + $ca['count'];

Then it calculates the stories correctly.


 
Posted : 20/07/2008 9:10 am
(@marauder-by-midnight)
Posts: 56
Trusted Member
Topic starter
 

When I replace:

if(in_array($ca['uid'], $alist)) $alist[$ca['uid']] = $alist[$ca['uid']] + $ca['count'];
else $alist[$ca['uid']] = $ca['count'];

with

$alist[$ca['uid']] = $alist[$ca['uid']] + $ca['count'];

I'm not able to access archive maintenance.


 
Posted : 20/07/2008 9:28 pm
(@julieann)
Posts: 60
Trusted Member
 

Well, it was fixed, and now the problem is back again. I'll try your fix this weekend Foz.

How annoying.


Julieann

Running 3.4.3 bridged with SMF and Coppermine
Mods: Challenges, cpg-art (not working), Limit Summary Length, Bio to Prefs, Top 20 instead of 10
Wants: Move Betareader to Prefs, Twitter
Gatchaman Fanfic Archive

 
Posted : 22/08/2008 11:21 am
(@julieann)
Posts: 60
Trusted Member
 

Okay, I just tried the changes in code that you suggested, Foz, and so far it seems to be working. I had our most prolific author go from showing 2 stories to the proper 57. Yay!

So far I haven't found any side-effects of the suggestion. I'll keep watching, though. πŸ™‚


Julieann

Running 3.4.3 bridged with SMF and Coppermine
Mods: Challenges, cpg-art (not working), Limit Summary Length, Bio to Prefs, Top 20 instead of 10
Wants: Move Betareader to Prefs, Twitter
Gatchaman Fanfic Archive

 
Posted : 23/08/2008 7:06 pm
(@grace)
Posts: 19
Active Member
 

That worked like a charm for me too, thanks!!!


 
Posted : 18/10/2008 11:50 am
(@tammy)
Posts: 2577
Member Moderator
 

Wrong change.  You'll throw notice errors if you fix it like that. Change:


if(in_array($ca['uid'], $alist))

to:


if(isset($ca['uid'], $alist))

Already done in 3.5


 
Posted : 23/10/2008 1:15 am
Jan_AQ
(@jan_aq)
Posts: 1300
Noble Member
 

Can you please check and see if this is still an issue with 3.5? Thank you!


Whoever said nothing is impossible never tried slamming a revolving door.

url: https://www.potionsandsnitches.org/fanfiction
php: 7.4.33 msql: 5.6.51-community GPL
efic version: 3.5.5 latest patches: yes
bridges: none mods: challenges, tracker, story end, beta, word

 
Posted : 07/04/2009 5:09 am
Jan_AQ
(@jan_aq)
Posts: 1300
Noble Member
 

No response... assumed solved.


Whoever said nothing is impossible never tried slamming a revolving door.

url: https://www.potionsandsnitches.org/fanfiction
php: 7.4.33 msql: 5.6.51-community GPL
efic version: 3.5.5 latest patches: yes
bridges: none mods: challenges, tracker, story end, beta, word

 
Posted : 23/11/2009 7:56 pm
Page 2 / 2
Share: