Compare commits

..

14 Commits

Author SHA1 Message Date
c44f035dcd preparations
Some checks failed
Build and push / Pulling repo on server (push) Successful in 6s
/ update_database (push) Failing after 14m28s
2023-12-26 21:31:53 +01:00
8543ebac7f flow changes
All checks were successful
Build and push / Pulling repo on server (push) Successful in 2s
2023-12-25 16:42:59 +01:00
4de6df7175 Merge branch 'master' of https://gitea.haschek.at/Crispi/dogstats 2023-12-25 16:39:12 +01:00
1dabcfbe0b update database 2023-12-24 03:07:50 +00:00
d299edd10d less errors please
Some checks failed
Build and push / Pulling repo on server (push) Successful in 2s
/ update_database (push) Failing after 6m58s
2023-12-23 20:08:39 +01:00
9757e58998 real deal
All checks were successful
Build and push / Pulling repo on server (push) Successful in 2s
/ update_database (push) Successful in 21s
2023-12-23 20:07:20 +01:00
a0f70c6619 so?
All checks were successful
Build and push / Pulling repo on server (push) Successful in 2s
/ update_database (push) Successful in 21s
2023-12-23 20:06:01 +01:00
63cbfb3681 just php
Some checks failed
Build and push / Pulling repo on server (push) Successful in 2s
/ update_database (push) Failing after 21s
2023-12-23 20:05:20 +01:00
1e1617eb53 shorter
Some checks failed
Build and push / Pulling repo on server (push) Successful in 2s
/ update_database (push) Failing after 11s
2023-12-23 20:04:18 +01:00
b1dbebf17f test2
All checks were successful
Build and push / Pulling repo on server (push) Successful in 2s
/ update_database (push) Successful in 1m0s
2023-12-23 20:02:41 +01:00
4eb299339e test 2023-12-23 20:02:16 +01:00
b6b82cae41 streamlined
All checks were successful
Build and push / Pulling repo on server (push) Successful in 2s
2023-12-23 19:53:52 +01:00
807aa70719 skip existing runs 2023-12-23 19:51:46 +01:00
53a614c5fd tried to implement import 2023-12-23 18:20:50 +01:00
7 changed files with 82 additions and 31 deletions

View File

@ -14,10 +14,12 @@ jobs:
uses: actions/checkout@v4
- name: run crawler
run: |
sed -i "/^error_reporting/c\error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT & ~E_WARNING & ~E_NOTICE" /etc/php/7.4/cli/php.ini
cd crawler
php crawler.php
git config --global user.email "gitea@haschek.at"
git config --global user.name "Gitea"
git pull
git add data.db
git commit -m "update database"
git push

3
.gitignore vendored
View File

@ -1 +1,2 @@
web/version.txt
web/version.txt
database.sqlite3

View File

@ -1,43 +1,41 @@
<?php
if(!file_exists('tmp/ergebnisse.html'))
{
$ergebnisse = file_get_contents('https://www.dognow.at/ergebnisse/');
file_put_contents('tmp/ergebnisse.html', $ergebnisse);
}
$GLOBALS['db'] = new SQLite3('data.db');
if(!$GLOBALS['db']) exit("Error loading database");
//389-7625.pdf.csv
// analyzeResultCSV('tmp/csv/389-7637.pdf.csv',7637,389);
// exit();
// if(!file_exists('tmp/ergebnisse.html'))
// {
// $ergebnisse = file_get_contents('https://www.dognow.at/ergebnisse/');
// file_put_contents('tmp/ergebnisse.html', $ergebnisse);
// }
$html = file_get_contents('tmp/ergebnisse.html');
// $html = file_get_contents('tmp/ergebnisse.html');
$dom = new DOMDocument;
$dom->loadHTML($html);
// $dom = new DOMDocument;
// $dom->loadHTML($html);
$xpath = new DOMXPath($dom);
$query = '//ul[@class="pagination"]/child::*';
$nodes = $xpath->query($query);
// $xpath = new DOMXPath($dom);
// $query = '//ul[@class="pagination"]/child::*';
// $nodes = $xpath->query($query);
$GLOBALS['pdfs'] = 0;
// $GLOBALS['pdfs'] = 0;
// Loop through the selected nodes
foreach ($nodes as $node) {
// Do something with each node, for example, echo its content
$url = $node->getElementsByTagName('a')[0]->getAttribute('href');
$number = intval($node->nodeValue);
if($number > $last_page){
$last_page = $number;
}
}
// // Loop through the selected nodes
// foreach ($nodes as $node) {
// // Do something with each node, for example, echo its content
// $url = $node->getElementsByTagName('a')[0]->getAttribute('href');
// $number = intval($node->nodeValue);
// if($number > $last_page){
// $last_page = $number;
// }
// }
echo "[i] Found $last_page pages\n";
// echo "[i] Found $last_page pages\n";
//create an array with all pages
$pages = range(1,65);
// //create an array with all pages
// $pages = range(1,65);
// foreach($pages as $page)
// {
@ -174,6 +172,11 @@ function getResults($run,$event)
$url = "https://www.dognow.at/ergebnisse/pdf.php?lauf=$run&event=$event";
if(!file_exists('tmp/results/' . $event . '-' . $run . '.pdf'))
file_put_contents('tmp/results/' . $event . '-' . $run . '.pdf',file_get_contents($url));
/*if($GLOBALS['db']->query("SELECT * FROM runs WHERE id = '$run' AND event = '$event'")->fetchArray() != false)
{
echo " [i] Skipping run $run in event $event\n";
return;
}*/
convertPDFtoCSV('tmp/results/' . $event . '-' . $run . '.pdf','tmp/csv/' . $event . '-' . $run . '.pdf.csv');
analyzeResultCSV('tmp/csv/' . $event . '-' . $run . '.pdf.csv',$run,$event);
}

Binary file not shown.

View File

@ -17,7 +17,7 @@ class User extends Model {
'dogs' => ['type'=> 'array','default'=>[]],
'tournaments' =>['type'=> 'array','default'=>[]],
'photo' => ['type'=>'text','default'=>'https://pictshare.net/pj7vzx.jpg'],
'theme' => ['type'=>'text','default'=>'light'], //light/dark
'theme' => ['type'=>'text','default'=>'light'], //light/dark
'active' => ['type'=>'int','default'=>0]
);
protected $hidden = ['password','token'];

View File

@ -34,6 +34,7 @@
<th>msek</th>
<th>bew</th>
<th>punkte</th>
<th>Action</th>
</tr>
<?php foreach ($results as $res) :
// graph data preparation
@ -67,7 +68,7 @@
?>
<tr>
<td><?= $res['event'] ?></td>
<td><?= $res['ago'] ?></td>
<td><?= date("d.m.Y", strtotime($res['date'])) ?></td>
<td><?= $res['run'] ?></td>
<td><?= $res['rang'] ?></td>
<td><?= $res['stnr'] ?></td>
@ -82,7 +83,24 @@
<td><?= $res['msek'] ?></td>
<td><?= $res['bew'] ?></td>
<td><?= $res['punkte'] ?></td>
<td>
<form id="tournament_import" hx-post="/tournaments/add" hx-encoding="multipart/form-data" hx-target="#main">
<input type="hidden" name="tournament_name" value="<?= $res['event'] ?>">
<input type="hidden" name="tournament_date" value="<?= date("d.m.Y", strtotime($res['date'])) ?>">
<input type="hidden" name="tournament_run" value="<?= $res['run'] ?>">
<input type="hidden" name="tournament_ranking" value="<?= $res['rang'] ?>">
<input type="hidden" name="tournament_number" value="<?= $res['stnr'] ?>">
<input type="hidden" name="tournament_participant" value="<?= $res['teilnehmer'] ?>">
<input type="hidden" name="tournament_dog" value="<?= $res['hund'] ?>">
<input type="hidden" name="tournament_club" value="<?= $res['verein'] ?>">
<input type="hidden" name="tournament_faults" value="<?= $res['f'] ?>">
<input type="hidden" name="tournament_refusals" value="<?= $res['vw'] ?>">
<input type="hidden" name="tournament_time" value="<?= $res['zeit'] ?>">
<input type="hidden" name="tournament_speed" value="<?= $res['msek'] ?>">
<input type="hidden" name="tournament_points" value="<?= $res['punkte'] ?>">
<button type="submit">Importieren</button>
</form>
</td>
</tr>
<?php endforeach; ?>
</table>

View File

@ -32,8 +32,34 @@ class Tournaments extends Page {
function add()
{
$t = new Tournament();
$t->name = $_REQUEST['tournament_name'];
$t->date = date("d.m.Y", strtotime($_REQUEST['tournament_date']));
$t->duration = intval($_REQUEST['tournament_duration']);
$t->referee = $_REQUEST['tournament_referee'];
$t->text = $_REQUEST['tournament_text'];
$t->url = $_REQUEST['tournament_url'];
$t->logo = $_REQUEST['tournament_logo'];
$t->run = $_REQUEST['tournament_run'];
$t->run = $_REQUEST['tournament_run'];
$t->ranking = $_REQUEST['tournament_ranking'];
$t->number = $_REQUEST['tournament_number'];
$t->participant = $_REQUEST['tournament_participant'];
$t->dog = $_REQUEST['tournament_dog'];
$t->club = $_REQUEST['tournament_club'];
$t->faults = $_REQUEST['tournament_faults'];
$t->refusals = $_REQUEST['tournament_refusals'];
$t->time = $_REQUEST['tournament_time'];
$t->points = $_REQUEST['tournament_points'];
$t->speed = $_REQUEST['tournament_speed'];
var_dump($t->data);
$this->set('tournamentdata',$t->data);
$this->set('template','edit_tournament.html');
}
function index() {
$events = $_SESSION['user']->data['tournaments'];
@ -126,6 +152,7 @@ class Tournaments extends Page {
{
if($_REQUEST['submit'])
{
var_dump($_REQUEST);
$id = $_REQUEST['tournament_id'];
$name = $_REQUEST['tournament_name'];
$date = $_REQUEST['tournament_date'];