mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-24 12:07:23 +08:00
fix attendance
This commit is contained in:
@@ -584,13 +584,13 @@ class ExamRepository extends BaseRepository
|
|||||||
try {
|
try {
|
||||||
$updateResult = $this->updateProgress($examUser);
|
$updateResult = $this->updateProgress($examUser);
|
||||||
if ($updateResult) {
|
if ($updateResult) {
|
||||||
do_log("$logPrefix, [UPDATE_SUCCESS_RETURN_DIRECTLY]");
|
do_log("$logPrefix, [UPDATE_PROGRESS_SUCCESS_RETURN_DIRECTLY]");
|
||||||
return $updateResult;
|
return $updateResult;
|
||||||
} else {
|
} else {
|
||||||
do_log("$logPrefix, [UPDATE_SUCCESS_FAIL]");
|
do_log("$logPrefix, [UPDATE_PROGRESS_FAIL]");
|
||||||
}
|
}
|
||||||
} catch (\Exception $exception) {
|
} catch (\Exception $exception) {
|
||||||
do_log("$logPrefix, [UPDATE_SUCCESS_FAIL]: " . $exception->getMessage(), 'error');
|
do_log("$logPrefix, [UPDATE_PROGRESS_FAIL]: " . $exception->getMessage(), 'error');
|
||||||
}
|
}
|
||||||
$exam = $examUser->exam;
|
$exam = $examUser->exam;
|
||||||
$progress = $examUser->progress;
|
$progress = $examUser->progress;
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ class Attendance
|
|||||||
|
|
||||||
public function attend($initial = 10, $step = 5, $maximum = 2000, $continous = array())
|
public function attend($initial = 10, $step = 5, $maximum = 2000, $continous = array())
|
||||||
{
|
{
|
||||||
|
do_log(json_encode(func_get_args()));
|
||||||
if($this->check(true)) return false;
|
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__);
|
$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);
|
$doUpdate = mysql_num_rows($res);
|
||||||
@@ -31,8 +32,8 @@ class Attendance
|
|||||||
} else {
|
} else {
|
||||||
$row = [0, 0, 0];
|
$row = [0, 0, 0];
|
||||||
}
|
}
|
||||||
$points = min($initial + $step * $row['total_attend_times'], $maximum);
|
|
||||||
list($datediff, $days, $totalDays) = $row;
|
list($datediff, $days, $totalDays) = $row;
|
||||||
|
$points = min($initial + $step * $totalDays, $maximum);
|
||||||
$cdays = $datediff == 1 ? ++$days : 1;
|
$cdays = $datediff == 1 ? ++$days : 1;
|
||||||
if($cdays > 1){
|
if($cdays > 1){
|
||||||
krsort($continous);
|
krsort($continous);
|
||||||
|
|||||||
Reference in New Issue
Block a user