SMF Support > SMF 2.1.x Support

Problem with gender tracking...

<< < (2/2)

margarett:
Anyway, back to your original post, this is a bug (I'll open an issue in GH in some minutes)

I have 1 user: admin --> male

--- Quote ---Gender stats: Male: 1
--- End quote ---
I add another user. As there is no gender defined, stats are the same

I define the new member's gender (as admin, editing his profile): Female

--- Quote ---Gender stats:
    Male: 1
    Female: 1
--- End quote ---
Then I change the gender to "Male"

--- Quote ---Gender stats: Male: 1
--- End quote ---
Wrong...

I change the gender to "None"

--- Quote ---Gender stats:
    Male: 1
    None: 1
--- End quote ---

Change the gender to "Male" again:

--- Quote ---Gender stats:
    Male: 1
--- End quote ---

So it fails to update the stats when the gender is set to "Male"...

edit: when there is only 1 user, it correctly updates the stats None/Male/Female: 1
edit2: https://github.com/SimpleMachines/SMF2.1/issues/2666

Bob Perry of Web Presence Consulting:
After a lot more cussing than I care to admit, I have this functioning perfectly+...

Replace in Sources/Stats.php and see what yall think of this...


--- Code: --- // Let's calculate gender stats only every four minutes.
$disabled_fields = isset($modSettings['disabled_profile_fields']) ? explode(',', $modSettings['disabled_profile_fields']) : array();
if (!in_array('gender', $disabled_fields))
{
$context['gender']['Not Set'] = comma_format($modSettings['totalMembers']);
$context['gender']['Female'] = 0;
$context['gender']['Disabled'] = 0;
$context['gender']['Male'] = 0;

$result = $smcFunc['db_query']('', '
SELECT COUNT(m.id_member) AS notset, COUNT(c.value) AS cnt, c.value AS genderhit
FROM {db_prefix}members AS m
LEFT JOIN {db_prefix}themes AS c ON c.variable = "cust_gender"
WHERE m.id_member > {int:select} AND m.id_member = c.id_member
  GROUP BY c.value',
array(
'select' => 0,
)
);
while ($row = $smcFunc['db_fetch_assoc']($result))
{
$context['gender']['Not Set'] = $context['gender']['Not Set'] - $row['notset'];

// Assuming we're telling the genders in the forum...
if (!empty($row['genderhit']))
{
$context['gender'][$row['genderhit']] = $row['cnt'];
}
}
$smcFunc['db_free_result']($result);
}

--- End code ---

enjoy...

Bob Perry of Web Presence Consulting:
So, as I understand it so far, this fix above would be eligible to submit at github for integration into the source? It needs some minor tweaking like putting the cache statements back in, but it functions perfect on my 2.1 site as is... I can learn to move these things over there eventually I guess, but I care little for recognition of fixing it, if someone else who wants to scrape/tweak it a little  from here and shoot it over there for consideration is more than welcome to do so if not already done, it works great is all I know right now, must sleep

Kindred:
the thing is.... we can not scrape it from here.   Code submitted here is not released under the usage license that you agree to when you submit code to github

Bob Perry of Web Presence Consulting:

--- Quote from: Kindred on January 15, 2015, 01:02:58 AM ---the thing is.... we can not scrape it from here.   Code submitted here is not released under the usage license that you agree to when you submit code to github

--- End quote ---

Ok thanks man, I already went ahead and moved it to github as suggested but still learning how to navigate the unfamiliar format and procedures because I need to learn all that anyway with my own module under construction and progressing slowly but surely, this new SMF version hit me off guard somewhat and once I got a bit more deeply into it I saw immediately that yall have been into it amazingly over the top logically and methodically like I was accustomed to in the the IBM DB2 platform and Sequel, PHP's SQL counterpart... my enthusiasm shot through the ceiling dude, seriously this is going be be epic when completed... but anyway, so just posted it as a comment to margarett's linked issue provided, and I hope yall understand an old feller's odd mood swings at certain miscommunications and such, you'd think an old hand at non-visual text only communicating would be more tolerant, but then again... no no not going there again... this one reason I paid a small fortune for a pretty decent audio/video conference/streaming package, its not too bad but the old days of chatrooms like Yahoo was years ago are fading away fast I'm afraid, maybe the focus is just shifting to something different but you catch my drift...

Navigation

[0] Message Index

[*] Previous page

Go to full version