Browse Source

fix get latest time error

stanley-king 3 years atrás
parent
commit
048fcc4e5a
2 changed files with 5 additions and 7 deletions
  1. 1 1
      data/model/refill_stats.model.php
  2. 4 6
      test/TestRefillCommand.php

+ 1 - 1
data/model/refill_stats.model.php

@@ -12,7 +12,7 @@ class refill_statsModel extends Model
 
     public function latest_record_time()
     {
-        return $this->field('*')->where(['stat_id' => ['gt', 0], 'type' => 'system'])->order('stat_id desc')->limit(0)->find();
+        return $this->field('*')->where(['stat_id' => ['gt', 0], 'type' => 'system'])->order('time_stamp desc')->limit(0)->find();
     }
 
     public function getStatsInfo($condition = [], $fields = '*', $master = false, $lock = false)

+ 4 - 6
test/TestRefillCommand.php

@@ -21,15 +21,13 @@ class TestRefillCommand extends TestCase
     //docker-compose run -d phpcli php /var/www/html/phpunit-9.2.5.phar --filter "/(TestRefillCommand::testRefillStat)( .*)?$/" --test-suffix TestRefillCommand.php /var/www/html/test
     public function testRefillStat()
     {
-        $dates = ['2022-01-05',
-            '2022-01-06',
-            '2022-01-07',
-            '2022-01-08',
-            '2022-01-09',
+        $dates = [
             '2022-01-10',
             '2022-01-11',
             '2022-01-12',
-            '2022-01-14'];
+            '2022-01-14',
+            '2022-01-15'
+        ];
         $refill = new statistics\stat_refill();
         $refill->restat($dates);
     }