Skip to content
This repository has been archived by the owner on Jul 15, 2020. It is now read-only.

Commit

Permalink
Normalize and adjust admin topics points calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
petk committed May 22, 2016
1 parent b958457 commit e373a18
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ not excluded for getting higher score than other members :)
most cases turned off by administrators for various reasons, such as not
following the group's code of conduct or low quality.
* Offensive messages and inappropriate links can get you negative points.
* Some topics (such as administrators announcements and similar) are awarded with
extra points as a recognition for special contributions to the group.

**What is the default points configuration and why such configuration for calculation?**

Expand Down
4 changes: 2 additions & 2 deletions app/config/points.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,5 @@ urls:
- ['lmgtfy.com', -10]
- ['w3schools.com', -20]

# Points for special announcements and topics from group staff
points_for_admin_topics: '(topic.getUser().getId() in admins && contains(topic.getMessage(), "[!]") ) ? 20 : ((topic.getUser().getId() in admins) ? 10 : 0)'
# Points for topics from admins
points_for_admin_topics: '(topic.getUser().getId() in admins) ? 5 : 0'
3 changes: 1 addition & 2 deletions tests/PointsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,7 @@ public function topicsProvider()
'photo_only' => ['', 11, 'photo', true, ['name' => 'User Name', 'id' => 2000], 0],
'gif' => ['', 11, 'animated_image_share', true, ['name' => 'User Name', 'id' => 2000], 0],
'closed_topic' => ['Lorem ipsum dolor sit amet', 50, 'status', false, ['name' => 'User Name', 'id' => 2000], 0],
'admin_topic' => ['Lorem ipsum dolor sit amet', 0, 'status', true, ['name' => 'Admin User', 'id' => 1000], 11],
'admin_announcement' => ['[!]Lorem ipsum dolor sit amet', 0, 'status', true, ['name' => 'Admin User', 'id' => 1000], 21],
'admin_topic' => ['Lorem ipsum dolor sit amet', 0, 'status', true, ['name' => 'Admin User', 'id' => 1000], 6],
];
}

Expand Down

0 comments on commit e373a18

Please sign in to comment.