Closed Bug 1030673 Opened 10 years ago Closed 10 years ago

[groups] Group page should list common skills among group members.

Categories

(Participation Infrastructure :: Phonebook, defect)

2014-09.1
defect
Not set
normal

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: giorgos, Assigned: yogesh.kamble)

Details

(Whiteboard: [kb=1491744] )

Actual:
A group page lists skills of the group members, ordered by the _overall_ popularity of the skill.

E.g.
Member 1, Skill: javascript
Member 2, Skill: foo
Member 3, Skill: foo

- foo has in total 50 members and 2 members in this group
- javascript has in total 500 members and 1 members in this group.

Javascript is listed first and foo second.

Expected:

foo should be listed first and javascript second. 

Because we list at most 15 skills, this can result in common skills, popular among group members to be overiden by skills that are popular in the website but not popular in the group.
Can I work on this bug?
Hi Yogest,

Thanks for offering to contribute! Yes this bug is open for you to take over. Some django / orm / database skills are required to fix this. 

Please go ahead and setup your environment following the instructions here http://mozillians.rtfd.org/ and when you're ready comment here so I can assign the bug to you.

Thanks!
Assignee: nobody → yogesh.kamble
I set up local environment.
You are saying,skills which are listed in "Skills members have in common:" on group page should list common skills among group.

For Example:
Member1: python, jquery, mongodb
Member2: python, Mysql, Java
Member3: C, Jquery
Member4: Python, Mysql, Django
Member5: C#, jquery, C++

In this case what should be the excepted result in "Skills members have in common:"?
Flags: needinfo?(giorgos)
Result should be:

jquery
python
mysql
c
c# 
c++ 
django
java
mongo

Please note that skills are all lowercase.
Flags: needinfo?(giorgos)
In terms of mysql I need to run following query
"""
select gr.name, skill.name, count(skill.name) from groups_group as gr inner join groups_groupmembership as member on member.group_id = gr.id inner join profile_skills as pro_sk on pro_sk.userprofile_id = member.userprofile_id inner join profile as pro on pro.id = member.userprofile_id inner join auth_user as user on user.id = pro.user_id inner join groups_skill as skill on skill.id = pro_sk.skill_id where gr.url="python-group" group by skill.name order by count(skill.name) desc,skill.name;
"""

I will create ORM query for above one and will add in "show" method in groups/views.py.

please correct me if I am wrong. 
this is my first bug.
Sample result of query in above comment is
"""
+--------------+---------+-------------------+
| name         | name    | count(skill.name) |
+--------------+---------+-------------------+
| python group | jquery  |                 2 |
| python group | python  |                 2 |
| python group | c       |                 1 |
| python group | java    |                 1 |
| python group | mongodb |                 1 |
| python group | mysql   |                 1 |
+--------------+---------+-------------------+
6 rows in set (0.00 sec)

"""
ORM query 
"""
skills = (Skill.objects
                  .filter(members__in=group.members.all())
                  .annotate(skill_count=Count('name'))
                  .order_by('-skill_count',  'name'))
"""
Yogesh thanks for working on this. Can you please submit a pull request with your changes, so we can review?

Thanks!
Status: NEW → ASSIGNED
Flags: needinfo?(yogesh.kamble)
pull request sent
https://github.com/mozilla/mozillians/pull/1043
please take a look at it.
Flags: needinfo?(yogesh.kamble)
What info I have to provide ?
Yogesh you don't have to provide any more info. We'll review your pull request as soon as possible, but please give us a few days because things are pretty busy atm.
I reviewed the pull request and added comments. We're getting there but it's not ready yet.
I will debug the code again and make necessary changes and will send pull request.
I updated the code. please have a look at the pull request
https://github.com/mozilla/mozillians/pull/1043/files
Thanks for update yogesh. I don't believe that the new changes answer the comments in https://github.com/mozilla/mozillians/pull/1043#issuecomment-50768715 as I still get the same errors.
Whiteboard: [kb=1491744]
Commits pushed to master at https://github.com/mozilla/mozillians

https://github.com/mozilla/mozillians/commit/13b49b624aea2f1bb6c056e37d76a4eeaf91dff7
[fix bug 1030673] List common skills among group members.

https://github.com/mozilla/mozillians/commit/535675eee3812b15133af5cd956d4c6d2376fb47
Merge pull request #1088 from akatsoulas/1030673

[fix bug 1030673] List common skills among group members.
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Version: other → next
Cannot verify that on stage:

For this [1] group "django" skill should be listed after "html5" since "django" skill has more members among the "a miserable little pile of secrets" compared to eg. homebrewing (django 2 members, homebrewing 1 member).


[1] https://mozillians.allizom.org/en-US/group/a-misrable-little-pile-of-secrets/
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Commits pushed to master at https://github.com/mozilla/mozillians

https://github.com/mozilla/mozillians/commit/ecac07c57ec5fe58c14a56c5850392a0ead2e74e
[fix bug 1030673] Fix common skills calculation for each group.

https://github.com/mozilla/mozillians/commit/eb3593059a204a507b56ab26fdac2b171984a512
Merge pull request #1093 from akatsoulas/1030673

[fix bug 1030673] Fix common skills calculation for each group.
Status: REOPENED → RESOLVED
Closed: 10 years ago10 years ago
Resolution: --- → FIXED
Verified on stage.

The PR has been updated to list only skills that members of a group have in common.
In the example group of comment 17, the following skills are listed:

* python: 4 members
* javascript: 4 members
* django: 2 members
* html5: 2 members
Status: RESOLVED → VERIFIED
Version: next → 2014-09.1
You need to log in before you can comment on or make changes to this bug.