coala / community

Generic re-usable community site
https://coala-community.netlify.app
GNU Affero General Public License v3.0
19 stars 45 forks source link

Add meta-review to Gamification app #181

Open jayvdb opened 6 years ago

jayvdb commented 6 years ago

We have both meta-review and gamification.

And the rules for 'Developer' just changed to require use of meta-review, so that needs to be added to gamification

https://github.com/coala/coala/commit/42a3ffac059f279cd65c9539b8e44bf222782773

sks444 commented 6 years ago

@li-boxuan, which field in the participant model would tell us if the participant has done a meta-review or not?

li-boxuan commented 6 years ago

If user has done a meta-review: https://github.com/coala/community/blob/master/meta_review/models.py#L23 and https://github.com/coala/community/blob/master/meta_review/models.py#L32

If user has received a meta-review: https://github.com/coala/community/blob/master/meta_review/models.py#L17 and https://github.com/coala/community/blob/master/meta_review/models.py#L26

shikharvaish28 commented 6 years ago

What all needs to be added from the meta-review app? Example: From Participant Model, do I have to import and display fields like neg_in and pos_in ( meta-view received) and similarly for meta-review done. @sks444 @jayvdb

jayvdb commented 6 years ago

The final badge in gamification roughly matches our 'Developer' critieria , which was changed recently as already mentioned https://github.com/coala/coala/commit/42a3ffac059f279cd65c9539b8e44bf222782773

You need to update the final badge to include this new criteria

shikharvaish28 commented 6 years ago

Wrote this piece in gamification/data/config.py

    # Adding activities to the all-rounder badge
    all_rounder_badge = Badge.objects.get(
        name='The All-Rounder')
    all_rounder_activity1 = BadgeActivity.objects.get(
        name='Solved a difficulty/newcomer issue')
    all_rounder_activity2 = BadgeActivity.objects.get(
        name='Solved a difficulty/low issue')
    all_rounder_activity3 = Participant.objects.all()
    all_rounder_activities_list = [
        all_rounder_activity1,
        all_rounder_activity2,
        all_rounder_activity3
    ]

Expected this to work but receiving the following traceback:

rm: db.sqlite3: No such file or directory
+ mkdir private _site public
+ META_REVIEW_DATA=meta_review.json
+ EXPORTED_DATA='static/tasks.yaml static/instances.yaml static/meta_review.json'
+ ISSUES_JSON=issues.json
+ python manage.py fetch_deployed_data --allow-failure _site static/tasks.yaml static/instances.yaml static/meta_review.json
+ [[ -n '' ]]
+ python manage.py fetch_deployed_data _site issues.json --repo-name gh-board
+ python manage.py migrate
Operations to perform:
  Apply all migrations: contenttypes, data, gamification, gci, gsoc, meta_review, openhub
Running migrations:
  Applying contenttypes.0001_initial... OK
  Applying contenttypes.0002_remove_content_type_name... OK
  Applying data.0001_initial... OK
  Applying data.0002_auto_20180704_1130... OK
  Applying data.0003_auto_20180801_0456... OK
  Applying data.0004_auto_20180809_2229... OK
  Applying gamification.0001_initial... OK
  Applying gci.0001_initial... OK
  Applying gsoc.0001_initial... OK
  Applying meta_review.0001_initial... OK
  Applying meta_review.0002_auto_20180707_0305... OK
  Applying openhub.0001_initial... OK
+ python manage.py import_contributors_data
+ python manage.py import_issues_data
+ python manage.py import_merge_requests_data
+ python manage.py create_config_data
Traceback (most recent call last):
  File "manage.py", line 24, in <module>
    execute_from_command_line(sys.argv)
  File "/Users/shikharvaish/anaconda3/envs/test_env/lib/python3.6/site-packages/django/core/management/__init__.py", line 367, in execute_from_command_line
    utility.execute()
  File "/Users/shikharvaish/anaconda3/envs/test_env/lib/python3.6/site-packages/django/core/management/__init__.py", line 359, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/Users/shikharvaish/anaconda3/envs/test_env/lib/python3.6/site-packages/django/core/management/base.py", line 294, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/Users/shikharvaish/anaconda3/envs/test_env/lib/python3.6/site-packages/django/core/management/base.py", line 345, in execute
    output = self.handle(*args, **options)
  File "/Coding/GSoC/community/gamification/management/commands/create_config_data.py", line 18, in handle
    add_activities_to_badges()
  File "/Coding/GSoC/community/gamification/data/config.py", line 252, in add_activities_to_badges
    *all_rounder_activities_list)
  File "/Users/shikharvaish/anaconda3/envs/test_env/lib/python3.6/site-packages/django/db/models/fields/related_descriptors.py", line 881, in add
    self._add_items(self.source_field_name, self.target_field_name, *objs)
  File "/Users/shikharvaish/anaconda3/envs/test_env/lib/python3.6/site-packages/django/db/models/fields/related_descriptors.py", line 1028, in _add_items
    '%s__in' % target_field_name: new_ids,
  File "/Users/shikharvaish/anaconda3/envs/test_env/lib/python3.6/site-packages/django/db/models/query.py", line 796, in filter
    return self._filter_or_exclude(False, *args, **kwargs)
  File "/Users/shikharvaish/anaconda3/envs/test_env/lib/python3.6/site-packages/django/db/models/query.py", line 814, in _filter_or_exclude
    clone.query.add_q(Q(*args, **kwargs))
  File "/Users/shikharvaish/anaconda3/envs/test_env/lib/python3.6/site-packages/django/db/models/sql/query.py", line 1227, in add_q
    clause, _ = self._add_q(q_object, self.used_aliases)
  File "/Users/shikharvaish/anaconda3/envs/test_env/lib/python3.6/site-packages/django/db/models/sql/query.py", line 1253, in _add_q
    allow_joins=allow_joins, split_subq=split_subq,
  File "/Users/shikharvaish/anaconda3/envs/test_env/lib/python3.6/site-packages/django/db/models/sql/query.py", line 1183, in build_filter
    condition = lookup_class(lhs, value)
  File "/Users/shikharvaish/anaconda3/envs/test_env/lib/python3.6/site-packages/django/db/models/lookups.py", line 19, in __init__
    self.rhs = self.get_prep_lookup()
  File "/Users/shikharvaish/anaconda3/envs/test_env/lib/python3.6/site-packages/django/db/models/fields/related_lookups.py", line 56, in get_prep_lookup
    self.rhs = [target_field.get_prep_value(v) for v in self.rhs]
  File "/Users/shikharvaish/anaconda3/envs/test_env/lib/python3.6/site-packages/django/db/models/fields/related_lookups.py", line 56, in <listcomp>
    self.rhs = [target_field.get_prep_value(v) for v in self.rhs]
  File "/Users/shikharvaish/anaconda3/envs/test_env/lib/python3.6/site-packages/django/db/models/fields/__init__.py", line 946, in get_prep_value
    return int(value)
TypeError: int() argument must be a string, a bytes-like object or a number, not 'QuerySet'

Can't figure out why is this so. It would be great if @li-boxuan can have a look and suggest anything.

li-boxuan commented 6 years ago

Do you understand the logic of counting Badge Activity?

    all_rounder_activity3 = Participant.objects.all()
    all_rounder_activities_list = [
        all_rounder_activity1,
        all_rounder_activity2,
        all_rounder_activity3
    ]

This part doesn't make sense to me.

@shikharvaish28 If you are still having trouble debugging, you could create a pull request anyway. In that case reviewers can see all your code and the result of CI.

sks444 commented 6 years ago

@shikharvaish28, the criteria to complete meta-review is to do at least one meta-review or receive at least one meta-review.

1) The fields to state that the meta-review has been done by the user are pos_out and neg_out 2) And the fields to state that the meta-review has been received by the user are pos_in and neg_in.

So what you have to do is to get an activity named Completed meta-review system when the user has satisfied the first or the second condition mentioned above.

And then you can create a command to iterate over each of the gamification participants, finding out who has done Completed meta-review system activity and then adding it to their respective activity models.

After that, you need to create a badge activity with the similar name as Completed meta-review system and add that BadgeActivity to the all-rounder badge.

P.S. @jayvdb, I think that this issue should be labeled as difficulty/medium as it requires the understanding of the whole gamification system.