not quite
Build and push / Pulling repo on server (push) Successful in 3s Details

This commit is contained in:
Chris 2023-11-26 14:33:47 +01:00
parent a20749d900
commit afa288e702
2 changed files with 8 additions and 4 deletions

View File

@ -6,7 +6,9 @@
$GLOBALS['db'] = new SQLite3('data.db');
if(!$GLOBALS['db']) exit("Error loading database");
var_dump($GLOBALS['db']);
//389-7625.pdf.csv
// analyzeResultCSV('tmp/csv/389-7625.pdf.csv',7625,389);
// exit();
$html = file_get_contents('tmp/ergebnisse.html');
@ -165,9 +167,9 @@ function getResults($run,$event)
analyzeResultCSV('tmp/csv/' . $event . '-' . $run . '.pdf.csv',$run,$event);
}
function analyzeResultCSV($csv,$run,$event)
function analyzeResultCSV($csvfile,$run,$event)
{
$csv = array_map('str_getcsv', file($csv));
$csv = array_map('str_getcsv', file($csvfile));
//prepare header for database
foreach($csv[0] as $key=>$value){
@ -192,6 +194,7 @@ function analyzeResultCSV($csv,$run,$event)
$zeit = $row['zeit'];
$gf = $row['gf'];
$msek = $row['msek'];
$punkte = $row['punkte'];
$bew = $row['bew'];
//add result to db if not exists
@ -199,7 +202,8 @@ function analyzeResultCSV($csv,$run,$event)
{
$res = $GLOBALS['db']->query("SELECT * FROM results WHERE stnr = '$stnr' AND run = '$run' AND event = '$event'");
if($res->fetchArray() == false)
$GLOBALS['db']->exec("INSERT INTO results (stnr, rang, run, event, teilnehmer, hund, verein, f, vw, zf, zeit, gf, msek, bew) VALUES ('$stnr', '$rang', '$run', '$event', '$teilnehmer', '$hund', '$verein', '$f', '$vw', '$zf', '$zeit', '$gf', '$msek', '$bew')");
$GLOBALS['db']->exec("INSERT INTO results (stnr, rang, run, event, teilnehmer, hund, verein, f, vw, zf, zeit, gf, msek, bew, punkte) VALUES ('$stnr', '$rang', '$run', '$event', '$teilnehmer', '$hund', '$verein', '$f', '$vw', '$zf', '$zeit', '$gf', '$msek', '$bew', '$punkte')");
//else echo " [i] Skipping $teilnehmer in run $run in event $event\n";
}
catch(Exception $ex) {
//die( $ex->getMessage() );

Binary file not shown.