Commit current progress.

This commit is contained in:
calcu1on
2025-03-23 08:44:18 -04:00
parent e3425095dd
commit bef289950b
9 changed files with 145 additions and 30 deletions

View File

@@ -107,6 +107,9 @@ class Fighter {
* Checks is the fighters has stats to pull before proceeding.
*/
public function checkValidFighter(): bool {
if (!$this->crawler) {
return FALSE;
}
$athlete_stats = $this->crawler->filter('h2.stats-records__title')->count();
if ($athlete_stats == 0) {
return FALSE;

View File

@@ -163,6 +163,9 @@ class FightImporter {
*/
public static function createFightsByEvent($event, $context): void {
try {
/* \Drupal::messenger()->addStatus(print_r($event->field_event_url->uri)); */
/* \Drupal::messenger()->addStatus(print_r($event->label())); */
/* exit(); */
$event_page_html = \Drupal::httpClient()
->get(self::EVENT_BASE . $event->field_event_url->uri)
->getBody()->getContents();

View File

@@ -98,9 +98,9 @@ class FighterImporter {
else {
$fighters_by_div = self::getListOfCurrentFighters();
// Process each fighter into system.
/* foreach ($fighters_by_div as $division => $fighters) { */
/* $this->processDivision($division, $fighters); */
/* } */
foreach ($fighters_by_div as $division => $fighters) {
$this->processDivision($division, $fighters);
}
}
}
/**
@@ -109,7 +109,7 @@ class FighterImporter {
* @param mixed $div
* @param mixed $fighters
*/
public static function processDivision($div, $fighters, &$context): void {
public static function processDivision($div, $fighters): void {
\Drupal::logger('ufc')->notice("Starting to update $div");
foreach ($fighters as $fighter_data) {