Skip to content

Commit

Permalink
fix new user attendance don't increase bonus
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaomlove committed Mar 14, 2022
1 parent 0d3975d commit 3ad8fab
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions app/Repositories/AttendanceRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public function attend($uid)
'days' => 1,
'total_days' => 1,
];
$update = $initialData;
if (!$attendance) {
//first time
do_log("[DO_INSERT]: " . nexus_json_encode($initialData));
Expand All @@ -52,14 +53,15 @@ public function attend($uid)
} else {
//not continuous
do_log("[NOT_CONTINUOUS]");
$update = $initialData;
$update['total_days'] = $attendance->total_days + 1;
}
do_log("[DO_UPDATE]: " . nexus_json_encode($update));
$attendance->update($update);
User::query()->where('id', $uid)->increment('seedbonus', $update['points']);
}
}
if ($isUpdated) {
User::query()->where('id', $uid)->increment('seedbonus', $update['points']);
}
$attendance->added_time = $now->toTimeString();
$attendance->is_updated = $isUpdated;
do_log("[FINAL_ATTENDANCE]: " . $attendance->toJson());
Expand Down

0 comments on commit 3ad8fab

Please sign in to comment.