mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-03 14:10:57 +08:00
fix attendance
This commit is contained in:
@@ -584,13 +584,13 @@ class ExamRepository extends BaseRepository
|
||||
try {
|
||||
$updateResult = $this->updateProgress($examUser);
|
||||
if ($updateResult) {
|
||||
do_log("$logPrefix, [UPDATE_SUCCESS_RETURN_DIRECTLY]");
|
||||
do_log("$logPrefix, [UPDATE_PROGRESS_SUCCESS_RETURN_DIRECTLY]");
|
||||
return $updateResult;
|
||||
} else {
|
||||
do_log("$logPrefix, [UPDATE_SUCCESS_FAIL]");
|
||||
do_log("$logPrefix, [UPDATE_PROGRESS_FAIL]");
|
||||
}
|
||||
} catch (\Exception $exception) {
|
||||
do_log("$logPrefix, [UPDATE_SUCCESS_FAIL]: " . $exception->getMessage(), 'error');
|
||||
do_log("$logPrefix, [UPDATE_PROGRESS_FAIL]: " . $exception->getMessage(), 'error');
|
||||
}
|
||||
$exam = $examUser->exam;
|
||||
$progress = $examUser->progress;
|
||||
|
||||
@@ -22,6 +22,7 @@ class Attendance
|
||||
|
||||
public function attend($initial = 10, $step = 5, $maximum = 2000, $continous = array())
|
||||
{
|
||||
do_log(json_encode(func_get_args()));
|
||||
if($this->check(true)) return false;
|
||||
$res = sql_query(sprintf('SELECT DATEDIFF(%s, `added`) AS diff, `days`, `total_days` FROM `attendance` WHERE `uid` = %u ORDER BY `id` DESC LIMIT 1', sqlesc($this->curdate), $this->userid)) or sqlerr(__FILE__,__LINE__);
|
||||
$doUpdate = mysql_num_rows($res);
|
||||
@@ -31,8 +32,8 @@ class Attendance
|
||||
} else {
|
||||
$row = [0, 0, 0];
|
||||
}
|
||||
$points = min($initial + $step * $row['total_attend_times'], $maximum);
|
||||
list($datediff, $days, $totalDays) = $row;
|
||||
$points = min($initial + $step * $totalDays, $maximum);
|
||||
$cdays = $datediff == 1 ? ++$days : 1;
|
||||
if($cdays > 1){
|
||||
krsort($continous);
|
||||
|
||||
Reference in New Issue
Block a user