not quite
All checks were successful
Build and push / Pulling repo on server (push) Successful in 3s
All checks were successful
Build and push / Pulling repo on server (push) Successful in 3s
This commit is contained in:
parent
a20749d900
commit
afa288e702
@ -6,7 +6,9 @@
|
|||||||
$GLOBALS['db'] = new SQLite3('data.db');
|
$GLOBALS['db'] = new SQLite3('data.db');
|
||||||
if(!$GLOBALS['db']) exit("Error loading database");
|
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');
|
$html = file_get_contents('tmp/ergebnisse.html');
|
||||||
|
|
||||||
@ -165,9 +167,9 @@ function getResults($run,$event)
|
|||||||
analyzeResultCSV('tmp/csv/' . $event . '-' . $run . '.pdf.csv',$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
|
//prepare header for database
|
||||||
foreach($csv[0] as $key=>$value){
|
foreach($csv[0] as $key=>$value){
|
||||||
@ -192,6 +194,7 @@ function analyzeResultCSV($csv,$run,$event)
|
|||||||
$zeit = $row['zeit'];
|
$zeit = $row['zeit'];
|
||||||
$gf = $row['gf'];
|
$gf = $row['gf'];
|
||||||
$msek = $row['msek'];
|
$msek = $row['msek'];
|
||||||
|
$punkte = $row['punkte'];
|
||||||
$bew = $row['bew'];
|
$bew = $row['bew'];
|
||||||
|
|
||||||
//add result to db if not exists
|
//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'");
|
$res = $GLOBALS['db']->query("SELECT * FROM results WHERE stnr = '$stnr' AND run = '$run' AND event = '$event'");
|
||||||
if($res->fetchArray() == false)
|
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) {
|
catch(Exception $ex) {
|
||||||
//die( $ex->getMessage() );
|
//die( $ex->getMessage() );
|
||||||
|
BIN
crawler/data.db
BIN
crawler/data.db
Binary file not shown.
Reference in New Issue
Block a user