mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-14 12:30:49 +08:00
exam progress update when get
This commit is contained in:
@@ -23,16 +23,16 @@ class Attendance
|
||||
public function attend($initial = 10, $step = 5, $maximum = 2000, $continous = array())
|
||||
{
|
||||
if($this->check(true)) return false;
|
||||
$res = sql_query(sprintf('SELECT DATEDIFF(%s, `added`) AS diff, `days`, `total_days`, `total_points` 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);
|
||||
if ($doUpdate) {
|
||||
$row = mysql_fetch_row($res);
|
||||
do_log("uid: {$this->userid}, row: " . json_encode($row));
|
||||
} else {
|
||||
$row = [0, 0, 0, 0];
|
||||
$row = [0, 0, 0];
|
||||
}
|
||||
$points = min($initial + $step * $row['total_attend_times'], $maximum);
|
||||
list($datediff, $days, $totalDays, $totalPoints) = $row;
|
||||
list($datediff, $days, $totalDays) = $row;
|
||||
$cdays = $datediff == 1 ? ++$days : 1;
|
||||
if($cdays > 1){
|
||||
krsort($continous);
|
||||
|
||||
Reference in New Issue
Block a user