-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading status checks…
#35 wip calculate series
Showing
36 changed files
with
2,321 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
<?php | ||
|
||
namespace System25\T3sports\Command; | ||
|
||
use Contrib\Doctrine\Common\Collections\Collection; | ||
use Symfony\Component\Console\Command\Command; | ||
use Symfony\Component\Console\Helper\ProgressBar; | ||
use Symfony\Component\Console\Input\InputInterface; | ||
use Symfony\Component\Console\Input\InputOption; | ||
use Symfony\Component\Console\Output\OutputInterface; | ||
use System25\T3sports\Model\Club; | ||
use System25\T3sports\Model\Fixture; | ||
use System25\T3sports\Model\Series; | ||
use System25\T3sports\Series\SeriesBag; | ||
use System25\T3sports\Series\SeriesCalculationVisitorInterface; | ||
use System25\T3sports\Series\SeriesCalculator; | ||
|
||
/*************************************************************** | ||
* Copyright notice | ||
* | ||
* (c) 2010-2024 Rene Nitzsche | ||
* Contact: [email protected] | ||
* All rights reserved | ||
* | ||
* This library is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU Lesser General Public | ||
* License as published by the Free Software Foundation; either | ||
* version 2.1 of the License, or (at your option) any later version. | ||
* | ||
* This library is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public | ||
* License along with this library; if not, write to the Free Software | ||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
***************************************************************/ | ||
|
||
/** | ||
* Default filter for coach statistics. | ||
* | ||
* @author Rene Nitzsche | ||
*/ | ||
class CalculateSeriesCommand extends Command implements SeriesCalculationVisitorInterface | ||
{ | ||
private $seriesCalculator; | ||
/** @var OutputInterface */ | ||
private $output; | ||
/** @var ProgressBar */ | ||
private $clubProgress; | ||
/** @var ProgressBar */ | ||
private $matchProgress; | ||
|
||
public function __construct(SeriesCalculator $seriesCalculator) | ||
{ | ||
parent::__construct(null); | ||
$this->seriesCalculator = $seriesCalculator; | ||
} | ||
|
||
protected function configure() | ||
{ | ||
$this->addOption('uid', null, InputOption::VALUE_REQUIRED, 'UID of series to calculate.'); | ||
$this->setHelp('Calculate match series in T3sports.'); | ||
} | ||
|
||
protected function execute(InputInterface $input, OutputInterface $output) | ||
{ | ||
$this->output = $output; | ||
$output->writeln('<info>Calculate series.</info>'); | ||
$uid = $input->getOption('uid'); | ||
if ($uid === null) { | ||
$output->writeln('<error>Option --uid missing.</error>'); | ||
} | ||
$uid = (int) $uid; | ||
|
||
$this->seriesCalculator->calculate($uid, $this); | ||
|
||
$this->clubProgress->finish(); | ||
$this->matchProgress->finish(); | ||
// Do awesome stuff | ||
return Command::SUCCESS; | ||
} | ||
|
||
public function seriesLoaded(Series $series, array $clubUids): void | ||
{ | ||
$section = $this->output->section(); | ||
$this->output->writeln(sprintf('<info>Process "%s" for %d clubs</info>', $series->getProperty('label'), count($clubUids))); | ||
$this->clubProgress = new ProgressBar($section, count($clubUids)); | ||
$this->clubProgress->setFormat('very_verbose'); | ||
$this->clubProgress->start(); | ||
} | ||
|
||
public function matchesLoaded(Collection $matches): void | ||
{ | ||
if ($this->matchProgress) { | ||
$this->matchProgress->finish(); | ||
} | ||
$section = $this->output->section(); | ||
$this->matchProgress = new ProgressBar($section, count($matches)); | ||
$this->matchProgress->setFormat('debug'); | ||
$this->matchProgress->start(); | ||
} | ||
|
||
public function clubProcessed(Club $club, SeriesBag $seriesBag): void | ||
{ | ||
$this->clubProgress->advance(); | ||
$firstMatch = $seriesBag->getBestSeries()[0]; | ||
$lastMatch = $seriesBag->getBestSeries()[count($seriesBag->getBestSeries())-1]; | ||
$this->output->section()->writeln(sprintf('<info>Club (%s) %d series length: %d from %s to %s</info>', | ||
$club->getName(), | ||
$club->getUid(), count($seriesBag->getBestSeries()), | ||
date('d.m.Y', $firstMatch->getProperty('date')), | ||
date('d.m.Y', $lastMatch->getProperty('date')) | ||
)); | ||
} | ||
|
||
public function matchProcessed(Fixture $match): void | ||
{ | ||
$this->matchProgress->advance(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
namespace System25\T3sports\DependencyInjection; | ||
|
||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; | ||
use Symfony\Component\DependencyInjection\ContainerBuilder; | ||
use Symfony\Component\DependencyInjection\Reference; | ||
use System25\T3sports\Series\SeriesRuleInterface; | ||
use System25\T3sports\Series\SeriesRuleProvider; | ||
|
||
class SeriesRulePass implements CompilerPassInterface | ||
{ | ||
public function process(ContainerBuilder $container): void | ||
{ | ||
// always first check if the primary service is defined | ||
if (!$container->has(SeriesRuleProvider::class)) { | ||
return; | ||
} | ||
|
||
$definition = $container->findDefinition(SeriesRuleProvider::class); | ||
|
||
// find all service IDs with the t3sports.stats.indexer tag | ||
$taggedServices = $container->findTaggedServiceIds(SeriesRuleInterface::TAG); | ||
|
||
foreach ($taggedServices as $id => $tags) { | ||
// add the indexer to the IndexerProvider service | ||
$definition->addMethodCall('addSeriesRule', [new Reference($id)]); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?php | ||
|
||
namespace System25\T3sports\Hooks; | ||
|
||
use Sys25\RnBase\Database\Query\Join; | ||
|
||
/*************************************************************** | ||
* Copyright notice | ||
* | ||
* (c) 2010-2021 Rene Nitzsche | ||
* Contact: [email protected] | ||
* All rights reserved | ||
* | ||
* This library is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU Lesser General Public | ||
* License as published by the Free Software Foundation; either | ||
* version 2.1 of the License, or (at your option) any later version. | ||
* | ||
* This library is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public | ||
* License along with this library; if not, write to the Free Software | ||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
***************************************************************/ | ||
|
||
/** | ||
* Make additional join for club search. | ||
* | ||
* @author Rene Nitzsche | ||
*/ | ||
class ClubSearch | ||
{ | ||
public function getTableMappingMatch(&$params, $parent) | ||
{ | ||
$params['tableMapping']['SERIES_SCOPE_MM'] = 'tx_t3sportstats_series_scope_mm'; | ||
} | ||
|
||
public function getJoinsMatch(&$params, $parent) | ||
{ | ||
if (isset($params['tableAliases']['SERIES_SCOPE_MM'])) { | ||
$params['join'][] = new Join('CLUB', 'tx_t3sportstats_series_scope_mm', 'CLUB.uid = SERIES_SCOPE_MM.uid_foreign AND SERIES_SCOPE_MM.tablenames=\'tx_cfcleague_club\'', 'SERIES_SCOPE_MM'); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<?php | ||
|
||
namespace System25\T3sports\Model; | ||
|
||
use Sys25\RnBase\Domain\Model\BaseModel; | ||
|
||
/*************************************************************** | ||
* Copyright notice | ||
* | ||
* (c) 2010-2020 Rene Nitzsche ([email protected]) | ||
* All rights reserved | ||
* | ||
* This script is part of the TYPO3 project. The TYPO3 project is | ||
* free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* The GNU General Public License can be found at | ||
* http://www.gnu.org/copyleft/gpl.html. | ||
* | ||
* This script is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* This copyright notice MUST APPEAR in all copies of the script! | ||
***************************************************************/ | ||
|
||
/** | ||
* Model for a match series definition record. | ||
*/ | ||
class Series extends BaseModel | ||
{ | ||
public function getTableName() | ||
{ | ||
return 'tx_t3sportstats_series'; | ||
} | ||
|
||
/** | ||
* Returns the competition uid. | ||
* | ||
* @return int | ||
*/ | ||
public function getCompetitionUid() | ||
{ | ||
return $this->getProperty('competition'); | ||
} | ||
|
||
public function getMatchUid() | ||
{ | ||
return $this->getProperty('t3match'); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
|
||
namespace System25\T3sports\Model; | ||
|
||
use Sys25\RnBase\Domain\Model\BaseModel; | ||
|
||
/*************************************************************** | ||
* Copyright notice | ||
* | ||
* (c) 2010-2024 Rene Nitzsche ([email protected]) | ||
* All rights reserved | ||
* | ||
* This script is part of the TYPO3 project. The TYPO3 project is | ||
* free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* The GNU General Public License can be found at | ||
* http://www.gnu.org/copyleft/gpl.html. | ||
* | ||
* This script is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* This copyright notice MUST APPEAR in all copies of the script! | ||
***************************************************************/ | ||
|
||
/** | ||
* Model for a match series result record. | ||
*/ | ||
class SeriesResult extends BaseModel | ||
{ | ||
public function getTableName() | ||
{ | ||
return 'tx_t3sportstats_series_result'; | ||
} | ||
|
||
public function getUniqueKey(): ?string | ||
{ | ||
return $this->getProperty('uniquekey'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
<?php | ||
|
||
namespace System25\T3sports\Model; | ||
|
||
use Exception; | ||
use Sys25\RnBase\Domain\Model\BaseModel; | ||
use System25\T3sports\Series\SeriesRuleInterface; | ||
|
||
/*************************************************************** | ||
* Copyright notice | ||
* | ||
* (c) 2010-2024 Rene Nitzsche ([email protected]) | ||
* All rights reserved | ||
* | ||
* This script is part of the TYPO3 project. The TYPO3 project is | ||
* free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* The GNU General Public License can be found at | ||
* http://www.gnu.org/copyleft/gpl.html. | ||
* | ||
* This script is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* This copyright notice MUST APPEAR in all copies of the script! | ||
***************************************************************/ | ||
|
||
/** | ||
* Model for a match series rule record. | ||
*/ | ||
class SeriesRule extends BaseModel | ||
{ | ||
private $rule = null; | ||
|
||
public function getTableName() | ||
{ | ||
return 'tx_t3sportstats_series_rule'; | ||
} | ||
|
||
public function setRule(SeriesRuleInterface $rule) | ||
{ | ||
$this->rule = $rule; | ||
} | ||
|
||
public function isSatisfied(Fixture $match, bool $isHome): bool | ||
{ | ||
return $this->getRule()->isSatified($match, $isHome, $this->getProperty('config')); | ||
} | ||
|
||
private function getRule(): SeriesRuleInterface | ||
{ | ||
if ($this->rule === null) { | ||
throw new Exception('Missing rule implementation for '.$this->getUid()); | ||
} | ||
|
||
return $this->rule; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
namespace System25\T3sports\Repository; | ||
|
||
use Sys25\RnBase\Domain\Repository\PersistenceRepository; | ||
use System25\T3sports\Search\SeriesSearch; | ||
|
||
/*************************************************************** | ||
* Copyright notice | ||
* | ||
* (c) 2017-2024 Rene Nitzsche (rene@system25.de) | ||
* All rights reserved | ||
* | ||
* This script is part of the TYPO3 project. The TYPO3 project is | ||
* free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* The GNU General Public License can be found at | ||
* http://www.gnu.org/copyleft/gpl.html. | ||
* | ||
* This script is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* This copyright notice MUST APPEAR in all copies of the script! | ||
***************************************************************/ | ||
|
||
/** | ||
* @author Rene Nitzsche | ||
*/ | ||
class SeriesRepository extends PersistenceRepository | ||
{ | ||
public function getSearchClass() | ||
{ | ||
return SeriesSearch::class; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
<?php | ||
|
||
namespace System25\T3sports\Repository; | ||
|
||
use Contrib\Doctrine\Common\Collections\Collection; | ||
use Sys25\RnBase\Domain\Repository\PersistenceRepository; | ||
use System25\T3sports\Model\Club; | ||
use System25\T3sports\Model\Series; | ||
use System25\T3sports\Model\SeriesResult; | ||
use System25\T3sports\Search\SeriesResultSearch; | ||
use TYPO3\CMS\Core\Database\Query\QueryBuilder; | ||
|
||
/*************************************************************** | ||
* Copyright notice | ||
* | ||
* (c) 2017-2024 Rene Nitzsche (rene@system25.de) | ||
* All rights reserved | ||
* | ||
* This script is part of the TYPO3 project. The TYPO3 project is | ||
* free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* The GNU General Public License can be found at | ||
* http://www.gnu.org/copyleft/gpl.html. | ||
* | ||
* This script is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* This copyright notice MUST APPEAR in all copies of the script! | ||
***************************************************************/ | ||
|
||
/** | ||
* @author Rene Nitzsche | ||
*/ | ||
class SeriesResultRepository extends PersistenceRepository | ||
{ | ||
public function getSearchClass() | ||
{ | ||
return SeriesResultSearch::class; | ||
} | ||
|
||
/** | ||
* @return Collection<SeriesResult> | ||
*/ | ||
public function findBySeries(Series $series): Collection | ||
{ | ||
return $this->search(['SERIESRESULT.parentid' => [OP_EQ_INT => $series->getUid()]], []); | ||
} | ||
|
||
/** | ||
* @return Collection<SeriesResult> | ||
*/ | ||
public function findBySeriesAndClub(Series $series, Club $club): Collection | ||
{ | ||
return $this->search([ | ||
'SERIESRESULT.parentid' => [OP_EQ_INT => $series->getUid()], | ||
'SERIESRESULT.club' => [OP_EQ_INT => $club->getUid()], | ||
], []); | ||
} | ||
|
||
/** | ||
* | ||
* @param Series $series | ||
* @param mixed $clubUid | ||
* @return int | ||
*/ | ||
public function clearSeriesResultByClub(Series $series, $clubUid): int | ||
{ | ||
$result = 0; | ||
// Zuerst die Referenzen auf die Spiele entfernen | ||
$existingSeries = $this->findBySeriesAndClub($series, $clubUid); | ||
foreach($existingSeries as $existing) { | ||
$result += $this->clearSeriesResult($existing); | ||
} | ||
|
||
return $result; | ||
} | ||
|
||
public function clearSeriesResult(SeriesResult $seriesResult): int | ||
{ | ||
// Zuerst die Referenzen auf die Spiele entfernen | ||
$this->getConnection()->doDelete('tx_t3sportstats_series_result_mm', function(QueryBuilder $qb) use ($seriesResult) { | ||
$qb->where('uid_local = :seriesId') | ||
->setParameter('seriesId', $seriesResult->getUid()); | ||
}); | ||
|
||
$fields = [ | ||
'SERIESRESULT.uid' => [OP_EQ_INT => $seriesResult->getUid()], | ||
]; | ||
|
||
return $this->delete($fields); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?php | ||
|
||
namespace System25\T3sports\Repository; | ||
|
||
use Sys25\RnBase\Domain\Collection\BaseCollection; | ||
use Sys25\RnBase\Domain\Repository\PersistenceRepository; | ||
use System25\T3sports\Model\Series; | ||
use System25\T3sports\Search\SeriesRuleSearch; | ||
|
||
/*************************************************************** | ||
* Copyright notice | ||
* | ||
* (c) 2017-2024 Rene Nitzsche (rene@system25.de) | ||
* All rights reserved | ||
* | ||
* This script is part of the TYPO3 project. The TYPO3 project is | ||
* free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* The GNU General Public License can be found at | ||
* http://www.gnu.org/copyleft/gpl.html. | ||
* | ||
* This script is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* This copyright notice MUST APPEAR in all copies of the script! | ||
***************************************************************/ | ||
|
||
/** | ||
* @author Rene Nitzsche | ||
*/ | ||
class SeriesRuleRepository extends PersistenceRepository | ||
{ | ||
public function getSearchClass() | ||
{ | ||
return SeriesRuleSearch::class; | ||
} | ||
|
||
public function findBySeries(Series $series): BaseCollection | ||
{ | ||
return $this->search(['SERIESRULE.parentid' => [OP_EQ_INT => $series->getUid()]], []); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
<?php | ||
|
||
namespace System25\T3sports\Search; | ||
|
||
use Sys25\RnBase\Database\Query\Join; | ||
use Sys25\RnBase\Search\SearchBase; | ||
use Sys25\RnBase\Utility\Misc; | ||
use System25\T3sports\Model\SeriesResult; | ||
|
||
/*************************************************************** | ||
* Copyright notice | ||
* | ||
* (c) 2010-2024 Rene Nitzsche | ||
* Contact: rene@system25.de | ||
* All rights reserved | ||
* | ||
* This library is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU Lesser General Public | ||
* License as published by the Free Software Foundation; either | ||
* version 2.1 of the License, or (at your option) any later version. | ||
* | ||
* This library is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public | ||
* License along with this library; if not, write to the Free Software | ||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
***************************************************************/ | ||
|
||
/** | ||
* Class to search series results from database. | ||
* | ||
* @author Rene Nitzsche | ||
*/ | ||
class SeriesResultSearch extends SearchBase | ||
{ | ||
protected function getTableMappings() | ||
{ | ||
$tableMapping = []; | ||
$tableMapping['SERIESRESULT'] = $this->getBaseTable(); | ||
$tableMapping['SERIES'] = 'tx_t3sportstats_series'; | ||
|
||
// Hook to append other tables | ||
Misc::callHook('t3sportstats', 'search_SeriesResult_getTableMapping_hook', [ | ||
'tableMapping' => &$tableMapping, | ||
], $this); | ||
|
||
return $tableMapping; | ||
} | ||
|
||
protected function useAlias() | ||
{ | ||
return true; | ||
} | ||
|
||
protected function getBaseTableAlias() | ||
{ | ||
return 'SERIESRESULT'; | ||
} | ||
|
||
protected function getBaseTable() | ||
{ | ||
return 'tx_t3sportstats_series_result'; | ||
} | ||
|
||
public function getWrapperClass() | ||
{ | ||
return SeriesResult::class; | ||
} | ||
|
||
protected function getJoins($tableAliases) | ||
{ | ||
$join = []; | ||
if (isset($tableAliases['SERIES'])) { | ||
$join[] = new Join('SERIESRESULT', 'tx_t3sportstats_series', 'SERIES.uid = SERIESRESULT.parentid', 'SERIES'); | ||
} | ||
|
||
// Hook to append other tables | ||
Misc::callHook('t3sportstats', 'search_SeriesResult_getJoins_hook', [ | ||
'join' => &$join, | ||
'tableAliases' => $tableAliases, | ||
], $this); | ||
|
||
return $join; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
<?php | ||
|
||
namespace System25\T3sports\Search; | ||
|
||
use Sys25\RnBase\Database\Query\Join; | ||
use Sys25\RnBase\Search\SearchBase; | ||
use Sys25\RnBase\Utility\Misc; | ||
use System25\T3sports\Model\Series; | ||
use System25\T3sports\Model\SeriesRule; | ||
|
||
/*************************************************************** | ||
* Copyright notice | ||
* | ||
* (c) 2010-2024 Rene Nitzsche | ||
* Contact: rene@system25.de | ||
* All rights reserved | ||
* | ||
* This library is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU Lesser General Public | ||
* License as published by the Free Software Foundation; either | ||
* version 2.1 of the License, or (at your option) any later version. | ||
* | ||
* This library is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public | ||
* License along with this library; if not, write to the Free Software | ||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
***************************************************************/ | ||
|
||
/** | ||
* Class to search player stats from database. | ||
* | ||
* @author Rene Nitzsche | ||
*/ | ||
class SeriesRuleSearch extends SearchBase | ||
{ | ||
protected function getTableMappings() | ||
{ | ||
$tableMapping = []; | ||
$tableMapping['SERIESRULE'] = $this->getBaseTable(); | ||
$tableMapping['SERIES'] = 'tx_t3sportstats_series'; | ||
|
||
// Hook to append other tables | ||
Misc::callHook('t3sportstats', 'search_SeriesRule_getTableMapping_hook', [ | ||
'tableMapping' => &$tableMapping, | ||
], $this); | ||
|
||
return $tableMapping; | ||
} | ||
|
||
protected function useAlias() | ||
{ | ||
return true; | ||
} | ||
|
||
protected function getBaseTableAlias() | ||
{ | ||
return 'SERIESRULE'; | ||
} | ||
|
||
protected function getBaseTable() | ||
{ | ||
return 'tx_t3sportstats_series_rule'; | ||
} | ||
|
||
public function getWrapperClass() | ||
{ | ||
return SeriesRule::class; | ||
} | ||
|
||
protected function getJoins($tableAliases) | ||
{ | ||
$join = []; | ||
if (isset($tableAliases['SERIES'])) { | ||
$join[] = new Join('SERIESRULE', 'tx_t3sportstats_series', 'SERIES.uid = SERIESRULE.parentid', 'SERIES'); | ||
} | ||
|
||
// Hook to append other tables | ||
Misc::callHook('t3sportstats', 'search_SeriesRule_getJoins_hook', [ | ||
'join' => &$join, | ||
'tableAliases' => $tableAliases, | ||
], $this); | ||
|
||
return $join; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
<?php | ||
|
||
namespace System25\T3sports\Search; | ||
|
||
use Sys25\RnBase\Database\Query\Join; | ||
use Sys25\RnBase\Search\SearchBase; | ||
use Sys25\RnBase\Utility\Misc; | ||
use System25\T3sports\Model\CoachStat; | ||
use System25\T3sports\Model\Series; | ||
|
||
/*************************************************************** | ||
* Copyright notice | ||
* | ||
* (c) 2010-2022 Rene Nitzsche | ||
* Contact: rene@system25.de | ||
* All rights reserved | ||
* | ||
* This library is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU Lesser General Public | ||
* License as published by the Free Software Foundation; either | ||
* version 2.1 of the License, or (at your option) any later version. | ||
* | ||
* This library is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public | ||
* License along with this library; if not, write to the Free Software | ||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
***************************************************************/ | ||
|
||
/** | ||
* Class to search player stats from database. | ||
* | ||
* @author Rene Nitzsche | ||
*/ | ||
class SeriesSearch extends SearchBase | ||
{ | ||
protected function getTableMappings() | ||
{ | ||
$tableMapping = []; | ||
$tableMapping['SERIES'] = 'tx_t3sportstats_series'; | ||
$tableMapping['MATCH'] = 'tx_cfcleague_games'; | ||
$tableMapping['COMPETITION'] = 'tx_cfcleague_competition'; | ||
$tableMapping['CLUB'] = 'tx_cfcleague_club'; | ||
// Hook to append other tables | ||
Misc::callHook('t3sportstats', 'search_Series_getTableMapping_hook', [ | ||
'tableMapping' => &$tableMapping, | ||
], $this); | ||
|
||
return $tableMapping; | ||
} | ||
|
||
protected function useAlias() | ||
{ | ||
return true; | ||
} | ||
|
||
protected function getBaseTableAlias() | ||
{ | ||
return 'SERIES'; | ||
} | ||
|
||
protected function getBaseTable() | ||
{ | ||
return 'tx_t3sportstats_series'; | ||
} | ||
|
||
public function getWrapperClass() | ||
{ | ||
return Series::class; | ||
} | ||
|
||
protected function getJoins($tableAliases) | ||
{ | ||
$join = []; | ||
if (isset($tableAliases['MATCH'])) { | ||
$join[] = new Join('COACHSTAT', 'tx_cfcleague_games', 'MATCH.uid = COACHSTAT.t3match', 'MATCH'); | ||
} | ||
if (isset($tableAliases['COACH'])) { | ||
$join[] = new Join('COACHSTAT', 'tx_cfcleague_profiles', 'COACH.uid = COACHSTAT.coach', 'COACH'); | ||
} | ||
if (isset($tableAliases['COMPETITION'])) { | ||
$join[] = new Join('COACHSTAT', 'tx_cfcleague_competition', 'COMPETITION.uid = COACHSTAT.competition', 'COMPETITION'); | ||
} | ||
if (isset($tableAliases['CLUB'])) { | ||
$join[] = new Join('COACHSTAT', 'tx_cfcleague_club', 'CLUB.uid = COACHSTAT.club', 'CLUB'); | ||
} | ||
if (isset($tableAliases['CLUBOPP'])) { | ||
$join[] = new Join('COACHSTAT', 'tx_cfcleague_club', 'CLUBOPP.uid = COACHSTAT.clubopp', 'CLUBOPP'); | ||
} | ||
|
||
// Hook to append other tables | ||
Misc::callHook('t3sportstats', 'search_Series_getJoins_hook', [ | ||
'join' => &$join, | ||
'tableAliases' => $tableAliases, | ||
], $this); | ||
|
||
return $join; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php | ||
|
||
namespace System25\T3sports\Series\Rule; | ||
|
||
|
||
/*************************************************************** | ||
* Copyright notice | ||
* | ||
* (c) 2010-2024 Rene Nitzsche (rene@system25.de) | ||
* All rights reserved | ||
* | ||
* This script is part of the TYPO3 project. The TYPO3 project is | ||
* free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* The GNU General Public License can be found at | ||
* http://www.gnu.org/copyleft/gpl.html. | ||
* | ||
* This script is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* This copyright notice MUST APPEAR in all copies of the script! | ||
***************************************************************/ | ||
|
||
/** | ||
* Interface for series rule | ||
* | ||
*/ | ||
class LostRule extends MatchResultRule | ||
{ | ||
const ALIAS = 'LOST_RULE'; | ||
|
||
public function getAlias(): string | ||
{ | ||
return self::ALIAS; | ||
} | ||
|
||
protected function getStates(): array | ||
{ | ||
return [self::RESULT_LOST]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<?php | ||
|
||
namespace System25\T3sports\Series\Rule; | ||
|
||
use System25\T3sports\Model\Fixture; | ||
use System25\T3sports\Model\Team; | ||
use System25\T3sports\Series\SeriesRuleInterface; | ||
|
||
/*************************************************************** | ||
* Copyright notice | ||
* | ||
* (c) 2010-2024 Rene Nitzsche (rene@system25.de) | ||
* All rights reserved | ||
* | ||
* This script is part of the TYPO3 project. The TYPO3 project is | ||
* free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* The GNU General Public License can be found at | ||
* http://www.gnu.org/copyleft/gpl.html. | ||
* | ||
* This script is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* This copyright notice MUST APPEAR in all copies of the script! | ||
***************************************************************/ | ||
|
||
/** | ||
* Interface for series rule | ||
* | ||
*/ | ||
abstract class MatchResultRule implements SeriesRuleInterface | ||
{ | ||
const RESULT_WIN = 'win'; | ||
const RESULT_LOST = 'lost'; | ||
const RESULT_DRAW = 'draw'; | ||
|
||
public function getTcaLabel(): string | ||
{ | ||
return sprintf('LLL:EXT:t3sportstats/Resources/Private/Language/locallang_db.xlf:tx_t3sportstats_series_rule.%s', strtolower($this->getAlias())); | ||
} | ||
|
||
function setConfig($config): void | ||
{ | ||
|
||
} | ||
|
||
public function isSatified(Fixture $match, bool $isHome, $config): bool | ||
{ | ||
$toto = $match->getToto(); | ||
$result = self::RESULT_DRAW; | ||
if ($toto === 1) { | ||
$result = $isHome ? self::RESULT_WIN : self::RESULT_LOST; | ||
} elseif ($toto === 2) { | ||
$result = $isHome ? self::RESULT_LOST : self::RESULT_WIN; | ||
} | ||
|
||
return in_array($result, $this->getStates()); | ||
} | ||
|
||
abstract protected function getStates(): array; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php | ||
|
||
namespace System25\T3sports\Series\Rule; | ||
|
||
|
||
/*************************************************************** | ||
* Copyright notice | ||
* | ||
* (c) 2010-2024 Rene Nitzsche (rene@system25.de) | ||
* All rights reserved | ||
* | ||
* This script is part of the TYPO3 project. The TYPO3 project is | ||
* free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* The GNU General Public License can be found at | ||
* http://www.gnu.org/copyleft/gpl.html. | ||
* | ||
* This script is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* This copyright notice MUST APPEAR in all copies of the script! | ||
***************************************************************/ | ||
|
||
/** | ||
* Interface for series rule | ||
* | ||
*/ | ||
class NotLostRule extends MatchResultRule | ||
{ | ||
const ALIAS = 'NOT_LOST_RULE'; | ||
|
||
public function getAlias(): string | ||
{ | ||
return self::ALIAS; | ||
} | ||
|
||
protected function getStates(): array | ||
{ | ||
return [self::RESULT_WIN, self::RESULT_DRAW]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php | ||
|
||
namespace System25\T3sports\Series\Rule; | ||
|
||
|
||
/*************************************************************** | ||
* Copyright notice | ||
* | ||
* (c) 2010-2024 Rene Nitzsche (rene@system25.de) | ||
* All rights reserved | ||
* | ||
* This script is part of the TYPO3 project. The TYPO3 project is | ||
* free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* The GNU General Public License can be found at | ||
* http://www.gnu.org/copyleft/gpl.html. | ||
* | ||
* This script is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* This copyright notice MUST APPEAR in all copies of the script! | ||
***************************************************************/ | ||
|
||
/** | ||
* Interface for series rule | ||
* | ||
*/ | ||
class NotWonRule extends MatchResultRule | ||
{ | ||
const ALIAS = 'NOT_WON_RULE'; | ||
|
||
public function getAlias(): string | ||
{ | ||
return self::ALIAS; | ||
} | ||
|
||
protected function getStates(): array | ||
{ | ||
return [self::RESULT_LOST, self::RESULT_DRAW]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?php | ||
|
||
namespace System25\T3sports\Series\Rule; | ||
|
||
use System25\T3sports\Series\SeriesRuleInterface; | ||
|
||
/*************************************************************** | ||
* Copyright notice | ||
* | ||
* (c) 2010-2024 Rene Nitzsche (rene@system25.de) | ||
* All rights reserved | ||
* | ||
* This script is part of the TYPO3 project. The TYPO3 project is | ||
* free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* The GNU General Public License can be found at | ||
* http://www.gnu.org/copyleft/gpl.html. | ||
* | ||
* This script is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* This copyright notice MUST APPEAR in all copies of the script! | ||
***************************************************************/ | ||
|
||
/** | ||
* Interface for series rule | ||
* | ||
*/ | ||
class WinRule extends MatchResultRule | ||
{ | ||
const ALIAS = 'WIN_RULE'; | ||
|
||
public function getAlias(): string | ||
{ | ||
return self::ALIAS; | ||
} | ||
|
||
protected function getStates(): array | ||
{ | ||
return [self::RESULT_WIN]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
<?php | ||
|
||
namespace System25\T3sports\Series; | ||
|
||
use System25\T3sports\Model\Club; | ||
use System25\T3sports\Model\Fixture; | ||
|
||
/*************************************************************** | ||
* Copyright notice | ||
* | ||
* (c) 2010-2024 Rene Nitzsche (rene@system25.de) | ||
* All rights reserved | ||
* | ||
* This script is part of the TYPO3 project. The TYPO3 project is | ||
* free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* The GNU General Public License can be found at | ||
* http://www.gnu.org/copyleft/gpl.html. | ||
* | ||
* This script is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* This copyright notice MUST APPEAR in all copies of the script! | ||
***************************************************************/ | ||
|
||
/** | ||
* Sammel-Container für Serien bei der Ermittlung. | ||
* | ||
*/ | ||
class SeriesBag | ||
{ | ||
private $bestSeries = []; | ||
private $currentSeries = []; | ||
private $club; | ||
|
||
public function __construct(Club $club) | ||
{ | ||
$this->club = $club; | ||
} | ||
|
||
public function appendToSeries(Fixture $match) | ||
{ | ||
$this->currentSeries[] = $match; | ||
} | ||
|
||
public function breakSeries() | ||
{ | ||
if (count($this->currentSeries) > count($this->bestSeries)) { | ||
$this->bestSeries = $this->currentSeries; | ||
} | ||
$this->currentSeries = []; | ||
} | ||
|
||
/** | ||
* | ||
* @return Fixture[] | ||
*/ | ||
public function getBestSeries(): array | ||
{ | ||
return $this->bestSeries; | ||
} | ||
|
||
public function getClub(): ?Club | ||
{ | ||
return $this->club; | ||
} | ||
|
||
public function getClubUid(): int | ||
{ | ||
return $this->club->getUid(); | ||
} | ||
|
||
public function getFirstMatch(): ?Fixture | ||
{ | ||
return $this->bestSeries[0] ?? null; | ||
} | ||
|
||
public function getLastMatch(): ?Fixture | ||
{ | ||
return $this->bestSeries[$this->getSize() - 1] ?? null; | ||
} | ||
|
||
public function getSize(): int | ||
{ | ||
return count($this->bestSeries); | ||
} | ||
|
||
public function getHash(): string | ||
{ | ||
$uids = []; | ||
|
||
foreach($this->bestSeries as $fixture) { | ||
$uids[] = $fixture->getUid(); | ||
} | ||
|
||
return md5(implode(',', $uids)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
|
||
namespace System25\T3sports\Series; | ||
|
||
use Contrib\Doctrine\Common\Collections\Collection; | ||
use System25\T3sports\Model\Club; | ||
use System25\T3sports\Model\Fixture; | ||
use System25\T3sports\Model\Series; | ||
|
||
/*************************************************************** | ||
* Copyright notice | ||
* | ||
* (c) 2010-2024 Rene Nitzsche (rene@system25.de) | ||
* All rights reserved | ||
* | ||
* This script is part of the TYPO3 project. The TYPO3 project is | ||
* free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* The GNU General Public License can be found at | ||
* http://www.gnu.org/copyleft/gpl.html. | ||
* | ||
* This script is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* This copyright notice MUST APPEAR in all copies of the script! | ||
***************************************************************/ | ||
|
||
/** | ||
* Interface for series rule | ||
* | ||
*/ | ||
interface SeriesCalculationVisitorInterface | ||
{ | ||
function seriesLoaded(Series $series, array $clubUids): void; | ||
function clubProcessed(Club $club, SeriesBag $seriesBag): void; | ||
function matchesLoaded(Collection $matches): void; | ||
function matchProcessed(Fixture $match): void; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,264 @@ | ||
<?php | ||
|
||
namespace System25\T3sports\Series; | ||
|
||
use Contrib\Doctrine\Common\Collections\Collection; | ||
use Exception; | ||
use Sys25\RnBase\Database\Connection; | ||
use System25\T3sports\Model\Club; | ||
use System25\T3sports\Model\Fixture; | ||
use System25\T3sports\Model\Repository\ClubRepository; | ||
use System25\T3sports\Model\Repository\TeamRepository; | ||
use System25\T3sports\Model\Series; | ||
use System25\T3sports\Model\SeriesResult; | ||
use System25\T3sports\Model\SeriesRule; | ||
use System25\T3sports\Model\Team; | ||
use System25\T3sports\Repository\SeriesRepository; | ||
use System25\T3sports\Repository\SeriesResultRepository; | ||
use System25\T3sports\Repository\SeriesRuleRepository; | ||
use System25\T3sports\Service\MatchService; | ||
use System25\T3sports\Utility\ServiceRegistry; | ||
|
||
/*************************************************************** | ||
* Copyright notice | ||
* | ||
* (c) 2010-2024 Rene Nitzsche (rene@system25.de) | ||
* All rights reserved | ||
* | ||
* This script is part of the TYPO3 project. The TYPO3 project is | ||
* free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* The GNU General Public License can be found at | ||
* http://www.gnu.org/copyleft/gpl.html. | ||
* | ||
* This script is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* This copyright notice MUST APPEAR in all copies of the script! | ||
***************************************************************/ | ||
|
||
/** | ||
* Service for accessing team information. | ||
* | ||
* @author Rene Nitzsche | ||
*/ | ||
class SeriesCalculator | ||
{ | ||
private $matchService; | ||
private $seriesRepo; | ||
private $seriesRuleRepo; | ||
private $seriesResultRepo; | ||
private $teamRepo; | ||
private $clubRepo; | ||
private $ruleProvider; | ||
/** @var Connection */ | ||
private $dbConnection; | ||
|
||
public function __construct( | ||
SeriesRuleProvider $ruleProvider, | ||
ClubRepository $clubRepo, | ||
SeriesRepository $seriesRepo, | ||
SeriesResultRepository $seriesResultRepo, | ||
SeriesRuleRepository $seriesRuleRepo, | ||
TeamRepository $teamRepo, | ||
MatchService $matchService = null | ||
) { | ||
$this->ruleProvider = $ruleProvider; | ||
$this->matchService = $matchService ?: ServiceRegistry::getMatchService(); | ||
$this->seriesRepo = $seriesRepo; | ||
$this->seriesResultRepo = $seriesResultRepo; | ||
$this->seriesRuleRepo = $seriesRuleRepo; | ||
$this->teamRepo = $teamRepo; | ||
$this->clubRepo = $clubRepo; | ||
$this->dbConnection = Connection::getInstance(); | ||
} | ||
|
||
/** | ||
* (Re-)Calculate given series | ||
* | ||
* @param int $seriesUid | ||
*/ | ||
public function calculate(int $seriesUid, SeriesCalculationVisitorInterface $visitor) | ||
{ | ||
$series = $this->seriesRepo->findByUid($seriesUid); | ||
if ($series === null) { | ||
throw new Exception(sprintf('Match series with uid %d not found in database', $seriesUid)); | ||
} | ||
|
||
$scopeRules = $this->seriesRuleRepo->findBySeries($series); | ||
foreach($scopeRules as $scopeRule) { | ||
/** @var SeriesRule $scopeRule */ | ||
$scopeRule->setRule( | ||
$this->ruleProvider->getSeriesRuleByAlias($scopeRule->getProperty('rulealias')) | ||
); | ||
} | ||
|
||
$clubs = $this->clubRepo->search( | ||
['SERIES_SCOPE_MM.uid_local' => [OP_EQ_INT => $series->getUid()],], | ||
['what' => 'CLUB.uid',] | ||
); | ||
$clubs = $clubs->map(function($item){ return $item['uid'];})->toArray(); | ||
$ageGroup = $series->getProperty('agegroup'); | ||
|
||
if ($visitor) { | ||
$visitor->seriesLoaded($series, $clubs); | ||
} | ||
|
||
foreach($clubs as $clubUid) { | ||
$club = $this->clubRepo->findByUid($clubUid); | ||
$seriesBag = new SeriesBag($club); | ||
$matches = $this->lookupMatches($clubUid, $ageGroup); | ||
if ($visitor) { | ||
$visitor->matchesLoaded($matches); | ||
} | ||
|
||
foreach($matches as $match) { | ||
try { | ||
if ($this->isRuleSatisfied($match, $scopeRules, $clubUid, $ageGroup)) { | ||
$seriesBag->appendToSeries($match); | ||
} else { | ||
$seriesBag->breakSeries(); | ||
} | ||
} catch (TeamNotFoundException $e) { | ||
// This is okay | ||
continue; | ||
} finally { | ||
if ($visitor) { | ||
$visitor->matchProcessed($match); | ||
} | ||
} | ||
} | ||
$this->persistResult($seriesBag, $series); | ||
if ($visitor) { | ||
$visitor->clubProcessed($club, $seriesBag); | ||
} | ||
} | ||
return; | ||
} | ||
|
||
private function persistResult(SeriesBag $seriesBag, Series $series): void | ||
{ | ||
$existingSeries = $this->seriesResultRepo->findBySeriesAndClub($series, $seriesBag->getClub()); | ||
if ($existingSeries->count() > 1) { | ||
// Das sollte nicht vorkommen. Also löschen wir alles weg. | ||
$this->clearResult($existingSeries); | ||
$existingSeries = $this->seriesResultRepo->findBySeriesAndClub($series, $seriesBag->getClub()); | ||
} | ||
|
||
if ($seriesBag->getSize() < 2) { | ||
$this->clearResult($existingSeries); | ||
|
||
return; | ||
} | ||
|
||
/** @var SeriesResult $existingSeries */ | ||
$existingSeries = $existingSeries->first(); | ||
|
||
if ($existingSeries && $existingSeries->getUniqueKey() === $seriesBag->getHash()) { | ||
// Es hat sich nix verändert. | ||
|
||
return; | ||
} | ||
|
||
$this->clearResult($existingSeries); | ||
$result = new SeriesResult(); | ||
$result->setProperty('club', $seriesBag->getClubUid()); | ||
$result->setProperty('firstmatch', $seriesBag->getFirstMatch()->getUid()); | ||
$result->setProperty('lastmatch', $seriesBag->getLastMatch()->getUid()); | ||
$result->setProperty('quantity', $seriesBag->getSize()); | ||
$result->setProperty('pid', $series->getPid()); | ||
$result->setProperty('parentid', $series->getUid()); | ||
$result->setProperty('parenttable', 'tx_t3sportstats_series'); | ||
$result->setProperty('uniquekey', $seriesBag->getHash()); | ||
|
||
$this->seriesResultRepo->persist($result); | ||
foreach($seriesBag->getBestSeries() as $idx => $match) { | ||
$this->dbConnection->doInsert('tx_t3sportstats_series_result_mm', [ | ||
'uid_local' => $result->getUid(), | ||
'uid_foreign' => $match->getUid(), | ||
'tablenames' => 'tx_cfcleague_games', | ||
'sorting' => $idx, | ||
'sorting_foreign' => 0, | ||
]); | ||
} | ||
} | ||
|
||
private function clearResult($seriesResults): void | ||
{ | ||
if (!$seriesResults) { | ||
return; | ||
} | ||
|
||
if (!($seriesResults instanceof Collection)) { | ||
$seriesResults = [$seriesResults]; | ||
} | ||
|
||
foreach($seriesResults as $seriesResult) { | ||
$this->seriesResultRepo->clearSeriesResult($seriesResult); | ||
} | ||
} | ||
|
||
/** | ||
* | ||
* @param Fixture $match | ||
* @param Collection<SeriesRule> $rules | ||
* @param mixed $clubUid | ||
* @param mixed $ageGroupUid | ||
* @return bool | ||
*/ | ||
private function isRuleSatisfied(Fixture $match, Collection $rules, $clubUid, $ageGroupUid): bool | ||
{ | ||
// Team ermitteln | ||
$isHome = $this->isTeamHome($match, $clubUid, $ageGroupUid); | ||
|
||
$isSatified = true; | ||
foreach($rules as $rule) { | ||
/** @var SeriesRule $rule */ | ||
if (!$rule->isSatisfied($match, $isHome)) { | ||
return false; | ||
} | ||
} | ||
|
||
return $isSatified; | ||
} | ||
|
||
private function isTeamHome($match, $clubUid, $ageGroupUid): bool | ||
{ | ||
/** @var Team $team */ | ||
$team = $this->teamRepo->findByUid($match->getProperty('home')); | ||
if ($team->getProperty('club') === $clubUid | ||
&& ($team->getGroupUid() === $ageGroupUid || $team->getGroupUid() === 0)) { | ||
return true; | ||
} | ||
/** @var Team $team */ | ||
$team = $this->teamRepo->findByUid($match->getProperty('guest')); | ||
if ($team->getProperty('club') === $clubUid | ||
&& ($team->getGroupUid() === $ageGroupUid || $team->getGroupUid() === 0)) { | ||
return false; | ||
} | ||
|
||
throw new TeamNotFoundException(sprintf('Team for club %d not found in match %d', $clubUid, $match->getUid())); | ||
} | ||
|
||
private function lookupMatches($clubUid, $ageGroupUid): Collection | ||
{ | ||
$builder = $this->matchService->getMatchTableBuilder(); | ||
$builder->setStatus(Fixture::MATCH_STATUS_FINISHED); | ||
$builder->setAgeGroups($ageGroupUid); | ||
$builder->setClubs(''.$clubUid); | ||
$builder->setOrderByDate(false); | ||
$builder->setCompetitionObligation(1); | ||
|
||
$fields = $options = []; | ||
$builder->getFields($fields, $options); | ||
/** @var \Sys25\RnBase\Domain\Collection\BaseCollection $matches */ | ||
$matches = $this->matchService->search($fields, $options); | ||
|
||
return $matches; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
|
||
namespace System25\T3sports\Series; | ||
|
||
use System25\T3sports\Model\Club; | ||
use System25\T3sports\Model\Fixture; | ||
use System25\T3sports\Model\Team; | ||
|
||
/*************************************************************** | ||
* Copyright notice | ||
* | ||
* (c) 2010-2024 Rene Nitzsche (rene@system25.de) | ||
* All rights reserved | ||
* | ||
* This script is part of the TYPO3 project. The TYPO3 project is | ||
* free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* The GNU General Public License can be found at | ||
* http://www.gnu.org/copyleft/gpl.html. | ||
* | ||
* This script is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* This copyright notice MUST APPEAR in all copies of the script! | ||
***************************************************************/ | ||
|
||
/** | ||
* Interface for series rule | ||
* | ||
*/ | ||
interface SeriesRuleInterface | ||
{ | ||
const TAG = 't3sports.stats.seriesrule'; | ||
|
||
function getAlias(): string; | ||
function getTcaLabel(): string; | ||
function isSatified(Fixture $match, bool $isHome, $config): bool; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
<?php | ||
|
||
namespace System25\T3sports\Series; | ||
|
||
use Sys25\RnBase\Utility\Misc; | ||
|
||
/*************************************************************** | ||
* Copyright notice | ||
* | ||
* (c) 2010-2024 Rene Nitzsche (rene@system25.de) | ||
* All rights reserved | ||
* | ||
* This script is part of the TYPO3 project. The TYPO3 project is | ||
* free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* The GNU General Public License can be found at | ||
* http://www.gnu.org/copyleft/gpl.html. | ||
* | ||
* This script is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* This copyright notice MUST APPEAR in all copies of the script! | ||
***************************************************************/ | ||
|
||
/** | ||
* Zentrale Klasse für den Zugriff auf verschiedene Services. | ||
*/ | ||
class SeriesRuleProvider implements \TYPO3\CMS\Core\SingletonInterface | ||
{ | ||
private $rules = []; | ||
|
||
/** | ||
* Used by T3 versions without DI. | ||
* | ||
* @var SeriesRuleProvider | ||
*/ | ||
private static $instance = null; | ||
|
||
public function addSeriesRule(SeriesRuleInterface $rule) | ||
{ | ||
$alias = $rule->getAlias(); | ||
$this->rules[$alias] = $rule; | ||
} | ||
|
||
/** | ||
* @return SeriesRuleInterface | ||
*/ | ||
public function getSeriesRuleByAlias(string $alias) | ||
{ | ||
return $this->rules[$alias] ?? null; | ||
} | ||
|
||
/** | ||
* Only used by T3 versions prior to 10.x. | ||
* | ||
* @return self | ||
*/ | ||
public static function getInstance() | ||
{ | ||
if (null === self::$instance) { | ||
self::$instance = new self(); | ||
} | ||
|
||
return self::$instance; | ||
} | ||
|
||
public function getRules4Tca(array &$config): void | ||
{ | ||
$items = []; | ||
foreach ($this->rules as $rule) { | ||
$items[] = [ | ||
Misc::translateLLL($rule->getTCALabel()), | ||
$rule->getAlias(), | ||
]; | ||
} | ||
|
||
$config['items'] = $items; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
namespace System25\T3sports\Series; | ||
|
||
use Exception; | ||
|
||
/*************************************************************** | ||
* Copyright notice | ||
* | ||
* (c) 2010-2024 Rene Nitzsche (rene@system25.de) | ||
* All rights reserved | ||
* | ||
* This script is part of the TYPO3 project. The TYPO3 project is | ||
* free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* The GNU General Public License can be found at | ||
* http://www.gnu.org/copyleft/gpl.html. | ||
* | ||
* This script is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* This copyright notice MUST APPEAR in all copies of the script! | ||
***************************************************************/ | ||
|
||
/** | ||
* | ||
*/ | ||
class TeamNotFoundException extends Exception | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,6 +30,8 @@ | |
*/ | ||
interface StatsInterface | ||
{ | ||
const TAG = 't3sports.stats.indexer'; | ||
|
||
/** | ||
* @return string | ||
*/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,183 @@ | ||
<?php | ||
|
||
if (!(defined('TYPO3') || defined('TYPO3_MODE'))) { | ||
exit('Access denied.'); | ||
} | ||
|
||
$tx_t3sportstats_series = [ | ||
'ctrl' => [ | ||
'title' => 'LLL:EXT:t3sportstats/Resources/Private/Language/locallang_db.xlf:tx_t3sportstats_series', | ||
'label' => 'name', | ||
'label_alt' => 'label', | ||
'label_alt_force' => 1, | ||
'searchFields' => 'uid,name,label', | ||
'tstamp' => 'tstamp', | ||
'crdate' => 'crdate', | ||
'cruser_id' => 'cruser_id', | ||
'dividers2tabs' => true, | ||
'default_sortby' => 'ORDER BY name', | ||
'delete' => 'deleted', | ||
'enablecolumns' => [ | ||
'disabled' => 'hidden', | ||
], | ||
'iconfile' => 'EXT:cfc_league/Resources/Public/Icons/icon_table.gif', | ||
], | ||
'interface' => [ | ||
'showRecordFieldList' => 'label', | ||
], | ||
'feInterface' => [ | ||
'fe_admin_fieldList' => 'label', | ||
], | ||
'columns' => [ | ||
'name' => [ | ||
'exclude' => 1, | ||
'label' => 'LLL:EXT:t3sportstats/Resources/Private/Language/locallang_db.xlf:tx_t3sportstats_series_name', | ||
'config' => [ | ||
'type' => 'input', | ||
'size' => '30', | ||
'max' => '50', | ||
'eval' => 'required,trim', | ||
], | ||
], | ||
'label' => [ | ||
'exclude' => 1, | ||
'label' => 'LLL:EXT:t3sportstats/Resources/Private/Language/locallang_db.xlf:tx_t3sportstats_series_label', | ||
'config' => [ | ||
'type' => 'input', | ||
'size' => '30', | ||
'max' => '50', | ||
'eval' => 'required,trim', | ||
], | ||
], | ||
'saison' => [ | ||
'exclude' => 1, | ||
'label' => 'LLL:EXT:t3sportstats/Resources/Private/Language/locallang_db.xlf:tx_t3sportstats_series_saison', | ||
'config' => [ | ||
'type' => 'group', | ||
'internal_type' => 'db', | ||
'allowed' => 'tx_cfcleague_saison', | ||
'size' => 5, | ||
'autoSizeMax' => 20, | ||
'minitems' => 0, | ||
'maxitems' => 100, | ||
'MM' => 'tx_t3sportstats_series_scope_mm', | ||
'MM_match_fields' => [ | ||
'tablenames' => 'tx_cfcleague_saison', | ||
], | ||
], | ||
], | ||
'competitiontag' => [ | ||
'exclude' => 1, | ||
'label' => 'LLL:EXT:t3sportstats/Resources/Private/Language/locallang_db.xlf:tx_t3sportstats_tags', | ||
'config' => [ | ||
'type' => 'group', | ||
'internal_type' => 'db', | ||
'allowed' => 'tx_t3sportstats_tags', | ||
'size' => 5, | ||
'autoSizeMax' => 20, | ||
'minitems' => 0, | ||
'maxitems' => 100, | ||
'MM' => 'tx_t3sportstats_series_scope_mm', | ||
'MM_match_fields' => [ | ||
'tablenames' => 'tx_t3sportstats_tags', | ||
], | ||
], | ||
], | ||
'competition' => [ | ||
'exclude' => 1, | ||
'label' => 'LLL:EXT:t3sportstats/Resources/Private/Language/locallang_db.xlf:tx_t3sportstats_series_competition', | ||
'config' => [ | ||
'type' => 'group', | ||
'internal_type' => 'db', | ||
'allowed' => 'tx_cfcleague_competition', | ||
'size' => 5, | ||
'autoSizeMax' => 20, | ||
'minitems' => 0, | ||
'maxitems' => 100, | ||
'MM' => 'tx_t3sportstats_series_scope_mm', | ||
'MM_match_fields' => [ | ||
'tablenames' => 'tx_cfcleague_competition', | ||
], | ||
], | ||
], | ||
'agegroup' => [ | ||
'exclude' => 1, | ||
'label' => 'LLL:EXT:t3sportstats/Resources/Private/Language/locallang_db.xlf:tx_t3sportstats_series_agegroup', | ||
'config' => [ | ||
'type' => 'select', | ||
'renderType' => 'selectSingle', | ||
'items' => [['', 0]], | ||
'foreign_table' => 'tx_cfcleague_group', | ||
'foreign_table_where' => 'ORDER BY tx_cfcleague_group.sorting', | ||
'size' => 1, | ||
'minitems' => 0, | ||
'maxitems' => 1, | ||
'default' => 0, | ||
], | ||
], | ||
'club' => [ | ||
'exclude' => 1, | ||
'label' => 'LLL:EXT:t3sportstats/Resources/Private/Language/locallang_db.xlf:tx_t3sportstats_series_club', | ||
'config' => [ | ||
'type' => 'group', | ||
'internal_type' => 'db', | ||
'allowed' => 'tx_cfcleague_club', | ||
'size' => 5, | ||
'autoSizeMax' => 20, | ||
'minitems' => 0, | ||
'maxitems' => 100, | ||
'MM' => 'tx_t3sportstats_series_scope_mm', | ||
'MM_match_fields' => [ | ||
'tablenames' => 'tx_cfcleague_club', | ||
], | ||
], | ||
], | ||
'rules' => [ | ||
'label' => 'LLL:EXT:t3sportstats/Resources/Private/Language/locallang_db.xlf:tx_t3sportstats_series_rules', | ||
'description' => 'field description', | ||
'config' => [ | ||
'type' => 'inline', | ||
'foreign_table' => 'tx_t3sportstats_series_rule', | ||
'foreign_field' => 'parentid', | ||
'foreign_table_field' => 'parenttable', | ||
'appearance' => [ | ||
'showSynchronizationLink' => true, | ||
'showAllLocalizationLink' => true, | ||
'showPossibleLocalizationRecords' => true, | ||
], | ||
], | ||
], | ||
'results' => [ | ||
'label' => 'LLL:EXT:t3sportstats/Resources/Private/Language/locallang_db.xlf:tx_t3sportstats_series_results', | ||
'description' => 'All results for this series', | ||
'config' => [ | ||
'type' => 'inline', | ||
'foreign_table' => 'tx_t3sportstats_series_result', | ||
'foreign_field' => 'parentid', | ||
'foreign_table_field' => 'parenttable', | ||
'appearance' => [ | ||
'showNewRecordLink' => false, | ||
], | ||
], | ||
], | ||
], | ||
'types' => [ | ||
'0' => [ | ||
'showitem' => 'hidden,name,label,saison,competitiontag,competition,agegroup,club, | ||
--div--;LLL:EXT:t3sportstats/Resources/Private/Language/locallang_db.xlf:tx_t3sportstats_series_rules,rules, | ||
--div--;LLL:EXT:t3sportstats/Resources/Private/Language/locallang_db.xlf:tx_t3sportstats_series_results,results | ||
', | ||
], | ||
], | ||
'palettes' => [ | ||
'1' => [ | ||
'showitem' => '', | ||
], | ||
], | ||
]; | ||
|
||
if (\Sys25\RnBase\Utility\TYPO3::isTYPO104OrHigher()) { | ||
unset($tx_t3sportstats_series['interface']['showRecordFieldList']); | ||
} | ||
|
||
return $tx_t3sportstats_series; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
<?php | ||
|
||
if (!(defined('TYPO3') || defined('TYPO3_MODE'))) { | ||
exit('Access denied.'); | ||
} | ||
|
||
$tx_t3sportstats_series_result = [ | ||
'ctrl' => [ | ||
'title' => 'LLL:EXT:t3sportstats/Resources/Private/Language/locallang_db.xlf:tx_t3sportstats_series_result', | ||
'label' => 'uid', | ||
'label_alt' => 'club', | ||
'label_alt_force' => 1, | ||
'searchFields' => '', | ||
'tstamp' => 'tstamp', | ||
'crdate' => 'crdate', | ||
'cruser_id' => 'cruser_id', | ||
'dividers2tabs' => true, | ||
'hideTable' => true, | ||
'delete' => 'deleted', | ||
'enablecolumns' => [ | ||
], | ||
'iconfile' => 'EXT:cfc_league/Resources/Public/Icons/icon_table.gif', | ||
], | ||
'interface' => [ | ||
'showRecordFieldList' => 'rulealias', | ||
], | ||
'feInterface' => [ | ||
'fe_admin_fieldList' => 'rulealias', | ||
], | ||
'columns' => [ | ||
'club' => [ | ||
'exclude' => 1, | ||
'label' => 'LLL:EXT:t3sportstats/Resources/Private/Language/locallang_db.xlf:tx_t3sportstats_series_result_club', | ||
'config' => [ | ||
'type' => 'group', | ||
'allowed' => 'tx_cfcleague_club', | ||
'readonly' => '1', | ||
'maxitems' => 1, | ||
'size' => '1', | ||
], | ||
], | ||
'quantity' => [ | ||
'exclude' => 1, | ||
'label' => 'LLL:EXT:t3sportstats/Resources/Private/Language/locallang_db.xlf:tx_t3sportstats_series_result_quantity', | ||
'config' => [ | ||
'type' => 'input', | ||
'size' => '10', | ||
'readonly' => '1', | ||
], | ||
], | ||
'firstmatch' => [ | ||
'exclude' => 1, | ||
'label' => 'LLL:EXT:t3sportstats/Resources/Private/Language/locallang_db.xlf:tx_t3sportstats_series_result_firstmatch', | ||
'config' => [ | ||
'type' => 'group', | ||
'allowed' => 'tx_cfcleague_games', | ||
'readonly' => '1', | ||
'maxitems' => 1, | ||
'size' => '1', | ||
], | ||
], | ||
'lastmatch' => [ | ||
'exclude' => 1, | ||
'label' => 'LLL:EXT:t3sportstats/Resources/Private/Language/locallang_db.xlf:tx_t3sportstats_series_result_lastmatch', | ||
'config' => [ | ||
'type' => 'group', | ||
'allowed' => 'tx_cfcleague_games', | ||
'readonly' => '1', | ||
'maxitems' => 1, | ||
'size' => '1', | ||
], | ||
], | ||
'parentid' => [ | ||
'type' => 'passthrough' | ||
], | ||
'parenttable' => [ | ||
'type' => 'passthrough' | ||
], | ||
'uniquekey' => [ | ||
'type' => 'passthrough' | ||
], | ||
], | ||
'types' => [ | ||
'0' => [ | ||
'showitem' => 'club,quantity,firstmatch,lastmatch', | ||
], | ||
], | ||
'palettes' => [ | ||
'1' => [ | ||
'showitem' => '', | ||
], | ||
], | ||
]; | ||
|
||
if (\Sys25\RnBase\Utility\TYPO3::isTYPO104OrHigher()) { | ||
unset($tx_t3sportstats_series_result['interface']['showRecordFieldList']); | ||
} | ||
|
||
return $tx_t3sportstats_series_result; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
<?php | ||
|
||
if (!(defined('TYPO3') || defined('TYPO3_MODE'))) { | ||
exit('Access denied.'); | ||
} | ||
|
||
$tx_t3sportstats_series_rule = [ | ||
'ctrl' => [ | ||
'title' => 'LLL:EXT:t3sportstats/Resources/Private/Language/locallang_db.xlf:tx_t3sportstats_series_rule', | ||
'label' => 'rulealias', | ||
'searchFields' => 'rulealias', | ||
'tstamp' => 'tstamp', | ||
'crdate' => 'crdate', | ||
'cruser_id' => 'cruser_id', | ||
'dividers2tabs' => true, | ||
'hideTable' => true, | ||
'delete' => 'deleted', | ||
'enablecolumns' => [ | ||
], | ||
'iconfile' => 'EXT:cfc_league/Resources/Public/Icons/icon_table.gif', | ||
], | ||
'interface' => [ | ||
'showRecordFieldList' => 'rulealias', | ||
], | ||
'feInterface' => [ | ||
'fe_admin_fieldList' => 'rulealias', | ||
], | ||
'columns' => [ | ||
'rulealias' => [ | ||
'exclude' => 1, | ||
'label' => 'LLL:EXT:t3sportstats/Resources/Private/Language/locallang_db.xlf:tx_t3sportstats_series_rule_alias', | ||
'config' => [ | ||
'type' => 'select', | ||
'renderType' => 'selectSingle', | ||
'itemsProcFunc' => System25\T3sports\Series\SeriesRuleProvider::class.'->getRules4Tca', | ||
'size' => 1, | ||
'minitems' => 1, | ||
'maxitems' => 1, | ||
], | ||
], | ||
'config' => [ | ||
'exclude' => 1, | ||
'label' => 'LLL:EXT:t3sportstats/Resources/Private/Language/locallang_db.xlf:tx_t3sportstats_series_rule_config', | ||
'config' => [ | ||
'type' => 'text', | ||
'cols' => '30', | ||
'rows' => '5', | ||
], | ||
], | ||
|
||
], | ||
'types' => [ | ||
'0' => [ | ||
'showitem' => 'rulealias,config', | ||
], | ||
], | ||
'palettes' => [ | ||
'1' => [ | ||
'showitem' => '', | ||
], | ||
], | ||
]; | ||
|
||
if (\Sys25\RnBase\Utility\TYPO3::isTYPO104OrHigher()) { | ||
unset($tx_t3sportstats_series_rule['interface']['showRecordFieldList']); | ||
} | ||
|
||
return $tx_t3sportstats_series_rule; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Serien | ||
|
||
Es sollen Serien ermittelt werden. Also zum Beispiel wollen wir die längste Sieges- oder Niederlagenserie eines Vereins finden. Wir wollen also wissen, welche aufeinanderfolgenden Spiele ein oder mehrere gemeinsame Kriterien erfüllen. | ||
|
||
Im ersten Schritt legt man einen Datensatz vom Typ **Serie** an. Hier legt man zunächst fest, welche Spiele für die Serie ausgewertet werden sollen. Felder, die leer gelassen werden, schränken die Suche nicht ein. Wenn man also bspw. keine Saisondatensätze auswählt, dann wird über alle Spieljahre gesucht. | ||
|
||
Man muss nun eine Altersklasse aufwählen und einen oder mehrere Vereine auswählen. Die Serien werden dann für die Teams in der gewählten Alterklasse ermittelt. Will man für mehrere Altersklassen Serien ermitteln, dann muss man auch mehrere Serien erstellen. | ||
|
||
Im Tab **Regeln** kann man eine oder mehrere der verfügbaren Regeln konfigurieren. | ||
|
||
Ist die Serie gespeichert, kann man mit der UID die Suche starten. Dafür muss das Command **t3sports:stats:calculate-series** ausgeführt werden: | ||
|
||
```bash | ||
$ ./bin/typo3 t3sports:stats:calculate-series --uid=4 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,88 +1,121 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<xliff version="1.0"> | ||
<file source-language="en" target-language="de" datatype="plaintext" original="messages" data="2023-02-11T21-59-00" product-name="zsb"> | ||
<header/> | ||
<body> | ||
<trans-unit id="plugin.t3sportstats.label" xml:space="preserve"> | ||
<source>T3sports: Statistics</source> | ||
<target>T3sports: Statistiken</target> | ||
</trans-unit> | ||
<trans-unit id="plugin.t3sportstats.description" xml:space="preserve"> | ||
<source>Shows extensive statistics of players, trainers and referees</source> | ||
<target>Zeigt umfangreiche Statistiken von Spielern, Trainern and Schiedsrichtern</target> | ||
</trans-unit> | ||
<trans-unit id="plugin.t3sportstats.flexform.tab.common" xml:space="preserve"> | ||
<source>Common</source> | ||
<target/> | ||
</trans-unit> | ||
<trans-unit id="plugin.t3sportstats.flexform.tab.TSSetup" xml:space="preserve"> | ||
<source>TS-Setup</source> | ||
<target/> | ||
</trans-unit> | ||
<trans-unit id="plugin.t3sportstats.flexform.tssetup" xml:space="preserve"> | ||
<source>plugin.tx_t3sportstats.</source> | ||
<target/> | ||
</trans-unit> | ||
<trans-unit id="plugin.t3sportstats.flexform.action" xml:space="preserve"> | ||
<source>View</source> | ||
<target/> | ||
</trans-unit> | ||
<trans-unit id="plugin.t3sportstats.flexform.reporttype" xml:space="preserve"> | ||
<source>Report Type</source> | ||
<target>Auswertung</target> | ||
</trans-unit> | ||
<trans-unit id="plugin.t3sportstats.flexform.highlightteam" xml:space="preserve"> | ||
<source>Highlight team players</source> | ||
<target>Team Spieler hervorheben</target> | ||
</trans-unit> | ||
<trans-unit id="plugin.t3sportstats.flexform.action.playerstats" xml:space="preserve"> | ||
<source>Player statistics</source> | ||
<target>Spielerstatistik</target> | ||
</trans-unit> | ||
<trans-unit id="plugin.t3sportstats.flexform.action.coachstats" xml:space="preserve"> | ||
<source>Coach statistics</source> | ||
<target>Trainerstatistik</target> | ||
</trans-unit> | ||
<trans-unit id="plugin.t3sportstats.flexform.action.refereestats" xml:space="preserve"> | ||
<source>Referee statistics</source> | ||
<target>Schiedsrichterstatistik</target> | ||
</trans-unit> | ||
<trans-unit id="plugin.t3sportstats.flexform.action.dbstats" xml:space="preserve"> | ||
<source>Database statistics</source> | ||
<target>Datenbankstatistik</target> | ||
</trans-unit> | ||
<trans-unit id="service_t3sports_statistics_title" xml:space="preserve"> | ||
<source>Statistics service</source> | ||
<target>Statistik Service</target> | ||
</trans-unit> | ||
<trans-unit id="tx_cfcleague_match_notes.type.goalfreekick" xml:space="preserve"> | ||
<source>Free kick goal</source> | ||
<target>Freistoßtor</target> | ||
</trans-unit> | ||
<trans-unit id="plugin.t3sportstats.common.template" xml:space="preserve"> | ||
<source>Html-Template</source> | ||
<target/> | ||
</trans-unit> | ||
<trans-unit id="plugin.t3sportstats.common.sqldebug" xml:space="preserve"> | ||
<source>Debug SQL</source> | ||
<target/> | ||
</trans-unit> | ||
<trans-unit id="tx_t3sportstats_tags" xml:space="preserve"> | ||
<source>Tag</source> | ||
<target>Tag</target> | ||
</trans-unit> | ||
<trans-unit id="tx_t3sportstats_tags_name" xml:space="preserve"> | ||
<source>Name</source> | ||
<target>Name</target> | ||
</trans-unit> | ||
<trans-unit id="tx_t3sportstats_tags_label" xml:space="preserve"> | ||
<source>Label</source> | ||
<target>Label</target> | ||
</trans-unit> | ||
<trans-unit id="tx_t3sportstats_module_name" xml:space="preserve"> | ||
<source>Statistics</source> | ||
<target>Statistik</target> | ||
</trans-unit> | ||
</body> | ||
</file> | ||
<file source-language="en" target-language="de" datatype="plaintext" original="messages" data="2023-02-11T21-59-00" product-name="zsb"> | ||
<header/> | ||
<body> | ||
<trans-unit id="plugin.t3sportstats.label" xml:space="preserve"> | ||
<source>T3sports: Statistics</source> | ||
<target>T3sports: Statistiken</target> | ||
</trans-unit> | ||
<trans-unit id="plugin.t3sportstats.description" xml:space="preserve"> | ||
<source>Shows extensive statistics of players, trainers and referees</source> | ||
<target>Zeigt umfangreiche Statistiken von Spielern, Trainern and Schiedsrichtern</target> | ||
</trans-unit> | ||
<trans-unit id="plugin.t3sportstats.flexform.tab.common" xml:space="preserve"> | ||
<source>Common</source> | ||
<target/> | ||
</trans-unit> | ||
<trans-unit id="plugin.t3sportstats.flexform.tab.TSSetup" xml:space="preserve"> | ||
<source>TS-Setup</source> | ||
<target/> | ||
</trans-unit> | ||
<trans-unit id="plugin.t3sportstats.flexform.tssetup" xml:space="preserve"> | ||
<source>plugin.tx_t3sportstats.</source> | ||
<target/> | ||
</trans-unit> | ||
<trans-unit id="plugin.t3sportstats.flexform.action" xml:space="preserve"> | ||
<source>View</source> | ||
<target/> | ||
</trans-unit> | ||
<trans-unit id="plugin.t3sportstats.flexform.reporttype" xml:space="preserve"> | ||
<source>Report Type</source> | ||
<target>Auswertung</target> | ||
</trans-unit> | ||
<trans-unit id="plugin.t3sportstats.flexform.highlightteam" xml:space="preserve"> | ||
<source>Highlight team players</source> | ||
<target>Team Spieler hervorheben</target> | ||
</trans-unit> | ||
<trans-unit id="plugin.t3sportstats.flexform.action.playerstats" xml:space="preserve"> | ||
<source>Player statistics</source> | ||
<target>Spielerstatistik</target> | ||
</trans-unit> | ||
<trans-unit id="plugin.t3sportstats.flexform.action.coachstats" xml:space="preserve"> | ||
<source>Coach statistics</source> | ||
<target>Trainerstatistik</target> | ||
</trans-unit> | ||
<trans-unit id="plugin.t3sportstats.flexform.action.refereestats" xml:space="preserve"> | ||
<source>Referee statistics</source> | ||
<target>Schiedsrichterstatistik</target> | ||
</trans-unit> | ||
<trans-unit id="plugin.t3sportstats.flexform.action.dbstats" xml:space="preserve"> | ||
<source>Database statistics</source> | ||
<target>Datenbankstatistik</target> | ||
</trans-unit> | ||
<trans-unit id="service_t3sports_statistics_title" xml:space="preserve"> | ||
<source>Statistics service</source> | ||
<target>Statistik Service</target> | ||
</trans-unit> | ||
<trans-unit id="tx_cfcleague_match_notes.type.goalfreekick" xml:space="preserve"> | ||
<source>Free kick goal</source> | ||
<target>Freistoßtor</target> | ||
</trans-unit> | ||
<trans-unit id="plugin.t3sportstats.common.template" xml:space="preserve"> | ||
<source>Html-Template</source> | ||
<target/> | ||
</trans-unit> | ||
<trans-unit id="plugin.t3sportstats.common.sqldebug" xml:space="preserve"> | ||
<source>Debug SQL</source> | ||
<target/> | ||
</trans-unit> | ||
<trans-unit id="tx_t3sportstats_tags" xml:space="preserve"> | ||
<source>Tag</source> | ||
<target>Tag</target> | ||
</trans-unit> | ||
<trans-unit id="tx_t3sportstats_tags_name" xml:space="preserve"> | ||
<source>Name</source> | ||
<target>Name</target> | ||
</trans-unit> | ||
<trans-unit id="tx_t3sportstats_tags_label" xml:space="preserve"> | ||
<source>Label</source> | ||
<target>Label</target> | ||
</trans-unit> | ||
<trans-unit id="tx_t3sportstats_module_name" xml:space="preserve"> | ||
<source>Statistics</source> | ||
<target>Statistik</target> | ||
</trans-unit> | ||
|
||
<trans-unit id="tx_t3sportstats_series_rules" xml:space="preserve"> | ||
<source>Rules</source> | ||
<target>Regeln</target> | ||
</trans-unit> | ||
<trans-unit id="tx_t3sportstats_series_rule" xml:space="preserve"> | ||
<source>Series Rule</source> | ||
<target>Serienregel</target> | ||
</trans-unit> | ||
<trans-unit id="tx_t3sportstats_series_rule_alias" xml:space="preserve"> | ||
<source>Rule</source> | ||
<target>Regel</target> | ||
</trans-unit> | ||
<trans-unit id="tx_t3sportstats_series_rule_config" xml:space="preserve"> | ||
<source>Config (optional)</source> | ||
<target>Konfiguration (optional)</target> | ||
</trans-unit> | ||
<trans-unit id="tx_t3sportstats_series_rule.win_rule" xml:space="preserve"> | ||
<source>Won matches</source> | ||
<target>Gewonnene Spiele</target> | ||
</trans-unit> | ||
<trans-unit id="tx_t3sportstats_series_rule.lost_rule" xml:space="preserve"> | ||
<source>Lost matches</source> | ||
<target>Verlorene Spiele</target> | ||
</trans-unit> | ||
<trans-unit id="tx_t3sportstats_series_rule.not_won_rule" xml:space="preserve"> | ||
<source>Not won matches</source> | ||
<target>Nicht gewonnene Spiele</target> | ||
</trans-unit> | ||
<trans-unit id="tx_t3sportstats_series_rule.not_lost_rule" xml:space="preserve"> | ||
<source>Not lost matches</source> | ||
<target>Nicht verlorene Spiele</target> | ||
</trans-unit> | ||
</body> | ||
</file> | ||
</xliff> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters