Dynamic Gender Reporting in Dashboard

Shylo Hana Posted in Beginning Developers 7 years ago

After installing the MoreGenders component I found the Dashboard not entirely useful.
The related classes and library are male/female oriented.
I modified them to retrieve a list of genders from the database and populate the dashboard graphs dynamically according to what's in use rather than hard-coding genders.
I've created a patch, but don't know where to send it for the core development team to evaluate or whether to just post it here?
Any suggestions?

This topic has been closed!

[Topic is Close]

Replies
Indonesian Arsalan Shah Replied 6 years ago

Mary, We have also family to feed. Your friend or you didn't wanted to spend single cent on anything. Why don't you upgrade to 5.2? because you have customized the things and changed core files and you afraid to lose the changes. I respect you and you should also understand and respect developers.

I am closing this topic as the owner may getting spammed for irreverent replies.

@Shylo, i am sorry for the irreverent replies on the topic.

Indonesian Arsalan Shah Replied 6 years ago

Don't act stupid Mary ,you are using older version and don't blame us. This feature has been added in 5.2. I don't know what is the problem with you in understanding, we don't know you personally and you take everything personally. Please try to understand this is not kids playing stuff that we can fix things on one click and give anyone what they wish. To have something you need to atleast fullfil the requirements

Indonesian Arsalan Shah Replied 6 years ago

Because you are using old version upgrade your network please.

nz Shylo Hana Replied 6 years ago

You'll find them in the 'opensource-socialnetwork' or 'premium' source.
There's a series of files in the 'locale' directory (/locale/ossn.[country_code].php).

German Michael Zülsdorff Replied 7 years ago

This crazy editor doesn't seem to allow to save linefeeds \ n correctly, so I added that extra space

Okay, so basically it would be sufficient if Ossn stores the 2 colors for male and female in the main language file, additional colors would go to the MoreGenders compoment.

German Michael Zülsdorff Replied 7 years ago

Well,
what you could do is using ossn_print() and derive the colors from $gender + defined #xxxxx

Just gave it a try and my loop looks like this now:

foreach($genders as $gender => $total) {
        	echo	"{\ n";
        	echo	"value: $total,\ n";
        	echo	"color: '" . ossn_print($gender . ':gendercolor') . "',\ n";
        	echo	"highlight: '" . ossn_print($gender . ':gendercolor') . "',\ n";
        	echo	"label: '" . ucfirst(ossn_print($gender)) . "'\ n";
        	echo	"},\ n";
        }

and the accompanying language file entries

'male:gendercolor' => '#ff0000',
'female:gendercolor' => '#00ff00',
'robot:gendercolor' => '#0000ff',
nz Shylo Hana Replied 7 years ago

Your request wasn't confusing.
Your second observation about colours being different between the two graphs should be easy. It will be fixed by solving the first problem.
The problem for me is that the number of genders, and what they might be named, in the database is variable.
I've just thought of a 3rd approach that should be easy. I'll smash it out later today.

German Michael Zülsdorff Replied 7 years ago

Hmm ... maybe my request was a little confusing ...

What I wanted to say: With the old code we got only 2 colors AND these colors never changed.
So I got used to know: let's say females are pink and males are blue.

With your code colors are always different, so I might get pink for females one time, but the next time females may be blue. And that feels irritating to me.

Even more, when - as shown on my screenshot - males appear blue on the left graph but pink on the right one.

What I wanted to achieve was knowing with just one look ... ah ... the majority of currently logged in members are males - simply because I remember the color. Right now I always have to sort out first who is who.

nz Shylo Hana Replied 7 years ago

I can think of two possible solutions right now:

  1. Add the more common genders to the registration form/user page, assign colours to them in the dashboard, then default to grey for later (third-party) additions - or
  2. Use 2 alternating colours, so they may repeat, but would visually break up the data in the pie graphs

Thoughts?

German Michael Zülsdorff Replied 7 years ago

Just applied your patches: Great work Shylo!

There's two cosmetic changes I'd like to ask for, though. To me it appears a little irritating to see

  • different colors each time I open the dashboard
  • different gender colors on left and right graph.

No other issues so far. A big thank you.

enter image description here