Skip to content
GitLab
Menu
Why GitLab
Pricing
Contact Sales
Explore
Why GitLab
Pricing
Contact Sales
Explore
Sign in
Get free trial
Commits on Source (3)
(fix) Notification view for user state should be plural rewards_* -
#589
· 167c20ef
Guy Thouret
authored
Aug 01, 2019
167c20ef
(fix) Divide by zero error Contributions\DailyCollection -
#587
· d8348319
Guy Thouret
authored
Aug 01, 2019
d8348319
(fix) Send a notification when a user is rewarded with tokens for contributions -
#636
· 6a760f03
Guy Thouret
authored
Aug 01, 2019
6a760f03
Hide whitespace changes
Inline
Side-by-side
Controllers/Cli/Rewards.php
View file @
6a760f03
...
...
@@ -92,13 +92,14 @@ class Rewards extends Cli\Controller implements Interfaces\CliControllerInterfac
$reward
=
$manager
->
sync
();
$total
=
$total
->
add
(
$reward
->
getAmount
());
$leaderboard
[
$user
->
guid
]
=
(
$reward
->
getAmount
()
/
(
10
**
18
));
/*Dispatcher::trigger('notification', 'contributions', [
'to' => [$user->guid],
'from' => 100000000000000519,
'notification_view' => 'contributions',
'params' => [ 'amount' => (string) BigNumber::_($reward->getAmount()) ],
'message' => ''
]);*/
if
(
$reward
->
getAmount
()
>
0
)
{
Dispatcher
::
trigger
(
'notification'
,
'reward'
,
[
'to'
=>
[
$user
->
guid
],
'from'
=>
Core\Notification\Notification
::
SYSTEM_ENTITY
,
'notification_view'
=>
'rewards_summary'
,
'params'
=>
[
'amount'
=>
(
string
)
BigNumber
::
_
(
$reward
->
getAmount
())],
]);
}
$amnt
=
(
int
)
$reward
->
getAmount
();
echo
"
\n
[
$i
][
$guid
]: synced past 48 hours.
{
$amnt
}
/
$total
"
;
}
catch
(
\Exception
$e
)
{
...
...
Core/Analytics/Delegates/UpdateUserState.php
View file @
6a760f03
...
...
@@ -41,7 +41,7 @@ class UpdateUserState
{
if
(
$this
->
userState
->
getStateChange
()
!==
0
)
{
$notificationView
=
(
$this
->
userState
->
getStateChange
()
>
0
)
?
'reward_state_increase'
:
'reward_state_decrease'
;
'reward
s
_state_increase'
:
'reward
s
_state_decrease'
;
Dispatcher
::
trigger
(
'notification'
,
'reward'
,
[
'to'
=>
[
$this
->
userState
->
getUserGuid
()
...
...
Core/Rewards/Contributions/DailyCollection.php
View file @
6a760f03
...
...
@@ -65,7 +65,7 @@ class DailyCollection
error_log
(
$e
->
getMessage
());
}
$export
[
$timestamp
][
'share'
]
+=
(
$contribution
->
getScore
()
/
$totalScore
)
*
100
;
$export
[
$timestamp
][
'share'
]
+=
(
$totalScore
==
0
)
?
0
:
(
$contribution
->
getScore
()
/
$totalScore
)
*
100
;
}
return
array_values
(
$export
);
...
...