diff --git a/api.py b/api.py index 6608ae4504521e58ea6e0657c4140ab749b9ab10..39e7f9b4c5019975995ddf857d377888e88d87bb 100755 --- a/api.py +++ b/api.py @@ -94,7 +94,7 @@ class EccsResults(Resource): if (eccsDataTable): return '' else: - return jsonify(error='FileNotFound: ECCS2 script has not been executed on this day') + return jsonify(error='FileNotFound: ECCS2 script has not been executed on %s' % date) for line in lines: # Strip the line feed and carriage return characters diff --git a/web/index.php b/web/index.php index d7775b0e98b0dda55d980b44b377b6ffc7ec67ec..17db15d0c599b0042f55c6487bbdcd62559faf17 100644 --- a/web/index.php +++ b/web/index.php @@ -6,18 +6,10 @@ $firstFile = $files[3]; // [0] = '.' ; [1] = '..' ; [2] = '.gitignore' $str2strip = array("eccs2_", ".log"); $firstDate = str_replace($str2strip, "", $firstFile); -$latest_ctime = 0; -$latest_filename = ''; -$d = dir($directory); -while (false !== ($entry = $d->read())) { -$filepath = "{$directory}/{$entry}"; -//Check whether the entry is a file etc.: - if(is_file($filepath) && filectime($filepath) > $latest_ctime) { - $latest_ctime = filectime($filepath); - $latest_filename = $entry; - }//end if is file etc. -}//end while going over files in excel_uploads dir. -$lastDate = str_replace($str2strip, "", $latest_filename); +$files = scandir($directory, SCANDIR_SORT_DESCENDING); +$lastFile = $files[0]; + +$lastDate = str_replace($str2strip, "", $lastFile); ?> <!DOCTYPE html>