Skip to content
Snippets Groups Projects
Commit 3fd44eae authored by Marco Malavolti's avatar Marco Malavolti
Browse files

Simplified research of the last date

parent 38a9b424
No related branches found
No related tags found
No related merge requests found
...@@ -94,7 +94,7 @@ class EccsResults(Resource): ...@@ -94,7 +94,7 @@ class EccsResults(Resource):
if (eccsDataTable): if (eccsDataTable):
return '' return ''
else: 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: for line in lines:
# Strip the line feed and carriage return characters # Strip the line feed and carriage return characters
......
...@@ -6,18 +6,10 @@ $firstFile = $files[3]; // [0] = '.' ; [1] = '..' ; [2] = '.gitignore' ...@@ -6,18 +6,10 @@ $firstFile = $files[3]; // [0] = '.' ; [1] = '..' ; [2] = '.gitignore'
$str2strip = array("eccs2_", ".log"); $str2strip = array("eccs2_", ".log");
$firstDate = str_replace($str2strip, "", $firstFile); $firstDate = str_replace($str2strip, "", $firstFile);
$latest_ctime = 0; $files = scandir($directory, SCANDIR_SORT_DESCENDING);
$latest_filename = ''; $lastFile = $files[0];
$d = dir($directory);
while (false !== ($entry = $d->read())) { $lastDate = str_replace($str2strip, "", $lastFile);
$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);
?> ?>
<!DOCTYPE html> <!DOCTYPE html>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment