A whole lotta stuff.

This commit is contained in:
Dan Chadwick
2024-03-13 15:48:45 +00:00
parent 5ff8b4b357
commit d7f37baeb7
372 changed files with 12650 additions and 378 deletions

View File

@@ -0,0 +1,12 @@
# Fight Predictor Data Points
TO DEVELOP
---
Finish %
What % of fights do they win?
What % of fights does opponent win?
Who wins more often?
Who physically has the advantage?
Who has the momentum?

View File

@@ -0,0 +1,22 @@
uuid: 9020d6b1-7067-4178-884e-a36f2e24c865
langcode: en
status: true
dependencies:
config:
- node.type.fight
id: node.fight.promote
field_name: promote
entity_type: node
bundle: fight
label: 'Promoted to front page'
description: ''
required: false
translatable: true
default_value:
-
value: 0
default_value_callback: ''
settings:
on_label: 'On'
off_label: 'Off'
field_type: boolean

View File

@@ -0,0 +1,22 @@
uuid: 62516a1a-8798-4b75-b598-8ddfe1e957ab
langcode: en
status: true
dependencies:
config:
- node.type.fighter
id: node.fighter.promote
field_name: promote
entity_type: node
bundle: fighter
label: 'Promoted to front page'
description: ''
required: false
translatable: true
default_value:
-
value: 0
default_value_callback: ''
settings:
on_label: 'On'
off_label: 'Off'
field_type: boolean

View File

@@ -0,0 +1,85 @@
uuid: 46386617-61d1-4ef1-bcd0-762c7d39139d
langcode: en
status: true
dependencies:
config:
- field.field.node.fight.body
- field.field.node.fight.field_accuracy
- field.field.node.fight.field_event
- field.field.node.fight.field_fighter_one
- field.field.node.fight.field_fighter_two
- field.field.node.fight.field_prediction
- field.field.node.fight.field_result
- node.type.fight
id: node.fight.default
targetEntityType: node
bundle: fight
mode: default
content:
field_accuracy:
weight: 28
settings:
placeholder: ''
third_party_settings: { }
type: number
region: content
field_event:
weight: 1
settings: { }
third_party_settings: { }
type: options_buttons
region: content
field_fighter_one:
weight: 2
settings:
match_operator: CONTAINS
match_limit: 10
size: 60
placeholder: ''
third_party_settings: { }
type: entity_reference_autocomplete_tags
region: content
field_fighter_two:
weight: 3
settings:
match_operator: CONTAINS
match_limit: 10
size: 60
placeholder: ''
third_party_settings: { }
type: entity_reference_autocomplete_tags
region: content
field_prediction:
weight: 26
settings:
size: 60
placeholder: ''
third_party_settings: { }
type: string_textfield
region: content
field_result:
weight: 5
settings:
match_operator: CONTAINS
match_limit: 10
size: 60
placeholder: ''
third_party_settings: { }
type: entity_reference_autocomplete
region: content
title:
type: string_textfield
weight: 0
region: content
settings:
size: 60
placeholder: ''
third_party_settings: { }
hidden:
body: true
created: true
path: true
promote: true
status: true
sticky: true
uid: true

View File

@@ -0,0 +1,271 @@
uuid: efcb011e-c7f3-4101-b5d7-3ab6aa471ab5
langcode: en
status: true
dependencies:
config:
- field.field.node.fighter.body
- field.field.node.fighter.field_absorbed_per_min
- field.field.node.fighter.field_age
- field.field.node.fighter.field_decisions
- field.field.node.fighter.field_division
- field.field.node.fighter.field_first_name
- field.field.node.fighter.field_grappling_accuracy
- field.field.node.fighter.field_height
- field.field.node.fighter.field_knockdown_ratio
- field.field.node.fighter.field_knockouts
- field.field.node.fighter.field_last_name
- field.field.node.fighter.field_leg_reach
- field.field.node.fighter.field_losses
- field.field.node.fighter.field_player_photo
- field.field.node.fighter.field_reach
- field.field.node.fighter.field_strikes_per_minute
- field.field.node.fighter.field_striking_accuracy
- field.field.node.fighter.field_submissions
- field.field.node.fighter.field_takedowns_per_15
- field.field.node.fighter.field_ties
- field.field.node.fighter.field_weight
- field.field.node.fighter.field_wins
- node.type.fighter
module:
- field_group
- media_library
third_party_settings:
field_group:
group_information:
children:
- title
- field_first_name
- field_last_name
- field_player_photo
- field_height
- field_weight
- field_age
- field_reach
- field_leg_reach
- field_division
parent_name: ''
weight: 1
format_type: tab
region: content
format_settings:
description: 'The player information'
formatter: open
required_fields: true
id: ''
classes: ''
direction: vertical
effect: none
open: false
weight: 0
label: Information
group_statistics:
children:
- field_wins
- field_losses
- field_ties
- field_decisions
- field_knockouts
- field_submissions
- field_grappling_accuracy
- field_striking_accuracy
- field_strikes_per_minute
- field_absorbed_per_min
- field_takedowns_per_15
- field_knockdown_ratio
parent_name: ''
weight: 2
format_type: tab
region: content
format_settings:
description: 'The statistics for this fighter.'
formatter: open
required_fields: true
id: ''
classes: ''
effect: none
open: false
weight: 0
direction: vertical
element: div
show_label: false
label_element: h3
label_element_classes: ''
speed: fast
attributes: ''
label: Statistics
id: node.fighter.default
targetEntityType: node
bundle: fighter
mode: default
content:
field_absorbed_per_min:
weight: 21
settings:
placeholder: ''
third_party_settings: { }
type: number
region: content
field_age:
weight: 6
settings:
placeholder: ''
third_party_settings: { }
type: number
region: content
field_decisions:
weight: 15
settings:
placeholder: ''
third_party_settings: { }
type: number
region: content
field_division:
weight: 9
settings:
match_operator: CONTAINS
match_limit: 10
size: 60
placeholder: ''
third_party_settings: { }
type: entity_reference_autocomplete
region: content
field_first_name:
weight: 1
settings:
size: 60
placeholder: ''
third_party_settings: { }
type: string_textfield
region: content
field_grappling_accuracy:
weight: 18
settings:
placeholder: ''
third_party_settings: { }
type: number
region: content
field_height:
weight: 4
settings:
placeholder: ''
third_party_settings: { }
type: number
region: content
field_knockdown_ratio:
weight: 23
settings:
placeholder: ''
third_party_settings: { }
type: number
region: content
field_knockouts:
weight: 16
settings:
placeholder: ''
third_party_settings: { }
type: number
region: content
field_last_name:
weight: 2
settings:
size: 60
placeholder: ''
third_party_settings: { }
type: string_textfield
region: content
field_leg_reach:
weight: 8
settings:
placeholder: ''
third_party_settings: { }
type: number
region: content
field_losses:
weight: 13
settings:
size: 60
placeholder: ''
third_party_settings: { }
type: string_textfield
region: content
field_player_photo:
type: media_library_widget
weight: 3
settings:
media_types: { }
third_party_settings: { }
region: content
field_reach:
weight: 7
settings:
placeholder: ''
third_party_settings: { }
type: number
region: content
field_strikes_per_minute:
weight: 20
settings:
placeholder: ''
third_party_settings: { }
type: number
region: content
field_striking_accuracy:
weight: 19
settings:
placeholder: ''
third_party_settings: { }
type: number
region: content
field_submissions:
weight: 17
settings:
placeholder: ''
third_party_settings: { }
type: number
region: content
field_takedowns_per_15:
weight: 22
settings:
placeholder: ''
third_party_settings: { }
type: number
region: content
field_ties:
weight: 14
settings:
size: 60
placeholder: ''
third_party_settings: { }
type: string_textfield
region: content
field_weight:
weight: 5
settings:
placeholder: ''
third_party_settings: { }
type: number
region: content
field_wins:
weight: 12
settings:
size: 60
placeholder: ''
third_party_settings: { }
type: string_textfield
region: content
title:
type: string_textfield
weight: 0
region: content
settings:
size: 60
placeholder: ''
third_party_settings: { }
hidden:
body: true
created: true
path: true
promote: true
status: true
sticky: true
uid: true

View File

@@ -0,0 +1,80 @@
uuid: d879dd9e-73c7-4562-98c5-45f6e0505d0c
langcode: en
status: true
dependencies:
config:
- field.field.node.fight.body
- field.field.node.fight.field_accuracy
- field.field.node.fight.field_event
- field.field.node.fight.field_fighter_one
- field.field.node.fight.field_fighter_two
- field.field.node.fight.field_prediction
- field.field.node.fight.field_result
- node.type.fight
module:
- user
id: node.fight.default
targetEntityType: node
bundle: fight
mode: default
content:
field_accuracy:
weight: 8
label: above
settings:
thousand_separator: ''
decimal_separator: .
scale: 2
prefix_suffix: true
third_party_settings: { }
type: number_decimal
region: content
field_event:
weight: 1
label: hidden
settings:
link: true
third_party_settings: { }
type: entity_reference_label
region: content
field_fighter_one:
weight: 2
label: hidden
settings:
view_mode: teaser
link: false
third_party_settings: { }
type: entity_reference_entity_view
region: content
field_fighter_two:
weight: 3
label: hidden
settings:
view_mode: teaser
link: false
third_party_settings: { }
type: entity_reference_entity_view
region: content
field_prediction:
weight: 6
label: above
settings:
link_to_entity: false
third_party_settings: { }
type: string
region: content
field_result:
weight: 5
label: hidden
settings:
link: true
third_party_settings: { }
type: entity_reference_label
region: content
links:
weight: 0
region: content
settings: { }
third_party_settings: { }
hidden:
body: true

View File

@@ -0,0 +1,42 @@
uuid: 2d1d0d94-7623-4d5b-a4d7-749720857860
langcode: en
status: true
dependencies:
config:
- core.entity_view_mode.node.teaser
- field.field.node.fight.body
- field.field.node.fight.field_accuracy
- field.field.node.fight.field_event
- field.field.node.fight.field_fighter_one
- field.field.node.fight.field_fighter_two
- field.field.node.fight.field_prediction
- field.field.node.fight.field_result
- node.type.fight
module:
- text
- user
id: node.fight.teaser
targetEntityType: node
bundle: fight
mode: teaser
content:
body:
label: hidden
type: text_summary_or_trimmed
weight: 101
settings:
trim_length: 600
third_party_settings: { }
region: content
links:
weight: 100
settings: { }
third_party_settings: { }
region: content
hidden:
field_accuracy: true
field_event: true
field_fighter_one: true
field_fighter_two: true
field_prediction: true
field_result: true

View File

@@ -0,0 +1,237 @@
uuid: 62338666-d3ab-4b76-a45d-20e2ca85d41f
langcode: en
status: true
dependencies:
config:
- field.field.node.fighter.body
- field.field.node.fighter.field_absorbed_per_min
- field.field.node.fighter.field_age
- field.field.node.fighter.field_decisions
- field.field.node.fighter.field_division
- field.field.node.fighter.field_first_name
- field.field.node.fighter.field_grappling_accuracy
- field.field.node.fighter.field_height
- field.field.node.fighter.field_knockdown_ratio
- field.field.node.fighter.field_knockouts
- field.field.node.fighter.field_last_name
- field.field.node.fighter.field_leg_reach
- field.field.node.fighter.field_losses
- field.field.node.fighter.field_player_photo
- field.field.node.fighter.field_reach
- field.field.node.fighter.field_strikes_per_minute
- field.field.node.fighter.field_striking_accuracy
- field.field.node.fighter.field_submissions
- field.field.node.fighter.field_takedowns_per_15
- field.field.node.fighter.field_ties
- field.field.node.fighter.field_weight
- field.field.node.fighter.field_wins
- image.style.thumbnail
- node.type.fighter
module:
- media
- user
id: node.fighter.default
targetEntityType: node
bundle: fighter
mode: default
content:
field_absorbed_per_min:
type: number_decimal
weight: 6
region: content
label: above
settings:
thousand_separator: ''
decimal_separator: .
scale: 2
prefix_suffix: true
third_party_settings: { }
field_age:
weight: 3
label: above
settings:
thousand_separator: ''
decimal_separator: .
scale: 2
prefix_suffix: true
third_party_settings: { }
type: number_decimal
region: content
field_decisions:
type: number_decimal
weight: 7
region: content
label: above
settings:
thousand_separator: ''
decimal_separator: .
scale: 2
prefix_suffix: true
third_party_settings: { }
field_division:
type: entity_reference_label
weight: 8
region: content
label: above
settings:
link: true
third_party_settings: { }
field_grappling_accuracy:
type: number_decimal
weight: 9
region: content
label: above
settings:
thousand_separator: ''
decimal_separator: .
scale: 2
prefix_suffix: true
third_party_settings: { }
field_height:
weight: 1
label: above
settings:
thousand_separator: ''
decimal_separator: .
scale: 2
prefix_suffix: true
third_party_settings: { }
type: number_decimal
region: content
field_knockdown_ratio:
type: number_decimal
weight: 10
region: content
label: above
settings:
thousand_separator: ''
decimal_separator: .
scale: 2
prefix_suffix: true
third_party_settings: { }
field_knockouts:
type: number_decimal
weight: 17
region: content
label: above
settings:
thousand_separator: ''
decimal_separator: .
scale: 2
prefix_suffix: true
third_party_settings: { }
field_leg_reach:
weight: 5
label: above
settings:
thousand_separator: ''
decimal_separator: .
scale: 2
prefix_suffix: true
third_party_settings: { }
type: number_decimal
region: content
field_losses:
type: string
weight: 16
region: content
label: above
settings:
link_to_entity: false
third_party_settings: { }
field_player_photo:
type: media_thumbnail
weight: 0
label: hidden
settings:
image_style: thumbnail
image_link: ''
third_party_settings: { }
region: content
field_reach:
weight: 4
label: above
settings:
thousand_separator: ''
decimal_separator: .
scale: 2
prefix_suffix: true
third_party_settings: { }
type: number_decimal
region: content
field_strikes_per_minute:
type: number_decimal
weight: 15
region: content
label: above
settings:
thousand_separator: ''
decimal_separator: .
scale: 2
prefix_suffix: true
third_party_settings: { }
field_striking_accuracy:
type: number_decimal
weight: 14
region: content
label: above
settings:
thousand_separator: ''
decimal_separator: .
scale: 2
prefix_suffix: true
third_party_settings: { }
field_submissions:
type: number_decimal
weight: 11
region: content
label: above
settings:
thousand_separator: ''
decimal_separator: .
scale: 2
prefix_suffix: true
third_party_settings: { }
field_takedowns_per_15:
type: number_decimal
weight: 12
region: content
label: above
settings:
thousand_separator: ''
decimal_separator: .
scale: 2
prefix_suffix: true
third_party_settings: { }
field_ties:
type: string
weight: 18
region: content
label: above
settings:
link_to_entity: false
third_party_settings: { }
field_weight:
weight: 2
label: above
settings:
thousand_separator: ''
decimal_separator: .
scale: 2
prefix_suffix: true
third_party_settings: { }
type: number_decimal
region: content
field_wins:
type: string
weight: 13
region: content
label: above
settings:
link_to_entity: false
third_party_settings: { }
hidden:
body: true
field_first_name: true
field_last_name: true
links: true

View File

@@ -0,0 +1,77 @@
uuid: be9b697f-c86f-4de3-9a8e-13bbd743a872
langcode: en
status: true
dependencies:
config:
- core.entity_view_mode.node.rss
- field.field.node.fighter.body
- field.field.node.fighter.field_absorbed_per_min
- field.field.node.fighter.field_age
- field.field.node.fighter.field_decisions
- field.field.node.fighter.field_division
- field.field.node.fighter.field_first_name
- field.field.node.fighter.field_grappling_accuracy
- field.field.node.fighter.field_height
- field.field.node.fighter.field_knockdown_ratio
- field.field.node.fighter.field_knockouts
- field.field.node.fighter.field_last_name
- field.field.node.fighter.field_leg_reach
- field.field.node.fighter.field_losses
- field.field.node.fighter.field_player_photo
- field.field.node.fighter.field_reach
- field.field.node.fighter.field_strikes_per_minute
- field.field.node.fighter.field_striking_accuracy
- field.field.node.fighter.field_submissions
- field.field.node.fighter.field_takedowns_per_15
- field.field.node.fighter.field_ties
- field.field.node.fighter.field_weight
- field.field.node.fighter.field_wins
- image.style.thumbnail
- node.type.fighter
module:
- media
- user
id: node.fighter.rss
targetEntityType: node
bundle: fighter
mode: rss
content:
field_last_name:
weight: 1
label: hidden
settings:
link_to_entity: false
third_party_settings: { }
type: string
region: content
field_player_photo:
type: media_thumbnail
weight: 0
label: hidden
settings:
image_style: thumbnail
image_link: ''
third_party_settings: { }
region: content
hidden:
body: true
field_absorbed_per_min: true
field_age: true
field_decisions: true
field_division: true
field_first_name: true
field_grappling_accuracy: true
field_height: true
field_knockdown_ratio: true
field_knockouts: true
field_leg_reach: true
field_losses: true
field_reach: true
field_strikes_per_minute: true
field_striking_accuracy: true
field_submissions: true
field_takedowns_per_15: true
field_ties: true
field_weight: true
field_wins: true
links: true

View File

@@ -0,0 +1,70 @@
uuid: ed1e0abd-67ac-4ae9-ad96-28cafd354403
langcode: en
status: true
dependencies:
config:
- core.entity_view_mode.node.teaser
- field.field.node.fighter.body
- field.field.node.fighter.field_absorbed_per_min
- field.field.node.fighter.field_age
- field.field.node.fighter.field_decisions
- field.field.node.fighter.field_division
- field.field.node.fighter.field_first_name
- field.field.node.fighter.field_grappling_accuracy
- field.field.node.fighter.field_height
- field.field.node.fighter.field_knockdown_ratio
- field.field.node.fighter.field_knockouts
- field.field.node.fighter.field_last_name
- field.field.node.fighter.field_leg_reach
- field.field.node.fighter.field_losses
- field.field.node.fighter.field_player_photo
- field.field.node.fighter.field_reach
- field.field.node.fighter.field_strikes_per_minute
- field.field.node.fighter.field_striking_accuracy
- field.field.node.fighter.field_submissions
- field.field.node.fighter.field_takedowns_per_15
- field.field.node.fighter.field_ties
- field.field.node.fighter.field_weight
- field.field.node.fighter.field_wins
- image.style.medium
- node.type.fighter
module:
- media
- user
id: node.fighter.teaser
targetEntityType: node
bundle: fighter
mode: teaser
content:
field_player_photo:
type: media_thumbnail
weight: 0
region: content
label: hidden
settings:
image_style: medium
image_link: ''
third_party_settings: { }
hidden:
body: true
field_absorbed_per_min: true
field_age: true
field_decisions: true
field_division: true
field_first_name: true
field_grappling_accuracy: true
field_height: true
field_knockdown_ratio: true
field_knockouts: true
field_last_name: true
field_leg_reach: true
field_losses: true
field_reach: true
field_strikes_per_minute: true
field_striking_accuracy: true
field_submissions: true
field_takedowns_per_15: true
field_ties: true
field_weight: true
field_wins: true
links: true

View File

@@ -0,0 +1,32 @@
uuid: c2fa694b-d3bb-43ed-b9a8-cfe2c6aa61ac
langcode: en
status: true
dependencies:
config:
- field.field.taxonomy_term.ufc_events.field_event_date
- taxonomy.vocabulary.ufc_events
module:
- datetime
- text
id: taxonomy_term.ufc_events.default
targetEntityType: taxonomy_term
bundle: ufc_events
mode: default
content:
description:
label: hidden
type: text_default
weight: 0
region: content
settings: { }
third_party_settings: { }
field_event_date:
weight: 1
label: above
settings:
format_type: medium
timezone_override: ''
third_party_settings: { }
type: datetime_default
region: content
hidden: { }

View File

@@ -0,0 +1,23 @@
uuid: 7878bf2c-a3a4-42a7-a6cd-79f860d15395
langcode: en
status: true
dependencies:
config:
- field.storage.node.body
- node.type.fight
module:
- text
id: node.fight.body
field_name: body
entity_type: node
bundle: fight
label: Body
description: ''
required: false
translatable: true
default_value: { }
default_value_callback: ''
settings:
display_summary: true
required_summary: false
field_type: text_with_summary

View File

@@ -0,0 +1,23 @@
uuid: 0675782a-5e6b-47e6-b248-48cf7ee44144
langcode: en
status: true
dependencies:
config:
- field.storage.node.field_accuracy
- node.type.fight
id: node.fight.field_accuracy
field_name: field_accuracy
entity_type: node
bundle: fight
label: Accuracy
description: 'Accuracy of this prediction.'
required: false
translatable: false
default_value: { }
default_value_callback: ''
settings:
min: null
max: null
prefix: ''
suffix: '%'
field_type: float

View File

@@ -0,0 +1,29 @@
uuid: 08eeb95e-ad83-449b-b420-405c92f94888
langcode: en
status: true
dependencies:
config:
- field.storage.node.field_event
- node.type.fight
- taxonomy.vocabulary.ufc_events
id: node.fight.field_event
field_name: field_event
entity_type: node
bundle: fight
label: Event
description: 'The event for this fight.'
required: false
translatable: false
default_value: { }
default_value_callback: ''
settings:
handler: 'default:taxonomy_term'
handler_settings:
target_bundles:
ufc_events: ufc_events
sort:
field: name
direction: asc
auto_create: false
auto_create_bundle: ''
field_type: entity_reference

View File

@@ -0,0 +1,28 @@
uuid: c0e2a418-fa1b-450e-9496-31915af72a6c
langcode: en
status: true
dependencies:
config:
- field.storage.node.field_fighter_one
- node.type.fight
- node.type.fighter
id: node.fight.field_fighter_one
field_name: field_fighter_one
entity_type: node
bundle: fight
label: 'Fighter One'
description: 'The first fighter.'
required: false
translatable: false
default_value: { }
default_value_callback: ''
settings:
handler: 'default:node'
handler_settings:
target_bundles:
fighter: fighter
sort:
field: _none
auto_create: false
auto_create_bundle: ''
field_type: entity_reference

View File

@@ -0,0 +1,28 @@
uuid: 1cfef8e4-a358-402e-a6b9-6377abf8b12d
langcode: en
status: true
dependencies:
config:
- field.storage.node.field_fighter_two
- node.type.fight
- node.type.fighter
id: node.fight.field_fighter_two
field_name: field_fighter_two
entity_type: node
bundle: fight
label: 'Fighter Two'
description: 'The second fighter.'
required: false
translatable: false
default_value: { }
default_value_callback: ''
settings:
handler: 'default:node'
handler_settings:
target_bundles:
fighter: fighter
sort:
field: _none
auto_create: false
auto_create_bundle: ''
field_type: entity_reference

View File

@@ -0,0 +1,19 @@
uuid: 840cdb42-015b-4c66-b49b-420da49b42ae
langcode: en
status: true
dependencies:
config:
- field.storage.node.field_prediction
- node.type.fight
id: node.fight.field_prediction
field_name: field_prediction
entity_type: node
bundle: fight
label: Prediction
description: 'The prediction for this fight.'
required: false
translatable: false
default_value: { }
default_value_callback: ''
settings: { }
field_type: string

View File

@@ -0,0 +1,28 @@
uuid: f80f6e92-7f80-4706-9649-19cde2e63f97
langcode: en
status: true
dependencies:
config:
- field.storage.node.field_result
- node.type.fight
- node.type.fighter
id: node.fight.field_result
field_name: field_result
entity_type: node
bundle: fight
label: Result
description: 'The real result of the fight, aka WINNER.'
required: false
translatable: false
default_value: { }
default_value_callback: ''
settings:
handler: 'default:node'
handler_settings:
target_bundles:
fighter: fighter
sort:
field: _none
auto_create: false
auto_create_bundle: ''
field_type: entity_reference

View File

@@ -0,0 +1,23 @@
uuid: 582e98bf-ad72-4a75-b50f-6111d5b00629
langcode: en
status: true
dependencies:
config:
- field.storage.node.body
- node.type.fighter
module:
- text
id: node.fighter.body
field_name: body
entity_type: node
bundle: fighter
label: Body
description: ''
required: false
translatable: true
default_value: { }
default_value_callback: ''
settings:
display_summary: true
required_summary: false
field_type: text_with_summary

View File

@@ -0,0 +1,23 @@
uuid: bd26455b-a207-481f-9aac-2b2f61d118a0
langcode: en
status: true
dependencies:
config:
- field.storage.node.field_absorbed_per_min
- node.type.fighter
id: node.fighter.field_absorbed_per_min
field_name: field_absorbed_per_min
entity_type: node
bundle: fighter
label: 'Absorbed Per Min'
description: 'The strikes absorbed per minute for this fighter.'
required: false
translatable: false
default_value: { }
default_value_callback: ''
settings:
min: null
max: null
prefix: ''
suffix: ''
field_type: decimal

View File

@@ -0,0 +1,23 @@
uuid: 71fa4227-27da-4319-a823-aa0acde92145
langcode: en
status: true
dependencies:
config:
- field.storage.node.field_age
- node.type.fighter
id: node.fighter.field_age
field_name: field_age
entity_type: node
bundle: fighter
label: Age
description: 'The age of the fighter.'
required: false
translatable: false
default_value: { }
default_value_callback: ''
settings:
min: null
max: null
prefix: ''
suffix: ''
field_type: decimal

View File

@@ -0,0 +1,23 @@
uuid: 2c9e212b-4e0e-41c2-a924-ad1bc51a82de
langcode: en
status: true
dependencies:
config:
- field.storage.node.field_decisions
- node.type.fighter
id: node.fighter.field_decisions
field_name: field_decisions
entity_type: node
bundle: fighter
label: Decisions
description: 'The amount of decision wins this fighter has.'
required: false
translatable: false
default_value: { }
default_value_callback: ''
settings:
min: null
max: null
prefix: ''
suffix: ''
field_type: decimal

View File

@@ -0,0 +1,29 @@
uuid: 7cfd4a75-6ba7-4878-a391-f555f05d3beb
langcode: en
status: true
dependencies:
config:
- field.storage.node.field_division
- node.type.fighter
- taxonomy.vocabulary.ufc_divisions
id: node.fighter.field_division
field_name: field_division
entity_type: node
bundle: fighter
label: Division
description: 'The division this fighter is in.'
required: false
translatable: false
default_value: { }
default_value_callback: ''
settings:
handler: 'default:taxonomy_term'
handler_settings:
target_bundles:
ufc_divisions: ufc_divisions
sort:
field: name
direction: asc
auto_create: false
auto_create_bundle: ''
field_type: entity_reference

View File

@@ -0,0 +1,19 @@
uuid: 49c5a5bc-5e65-46ba-a4c8-c42b951a4ecc
langcode: en
status: true
dependencies:
config:
- field.storage.node.field_first_name
- node.type.fighter
id: node.fighter.field_first_name
field_name: field_first_name
entity_type: node
bundle: fighter
label: 'First Name'
description: 'First name.'
required: false
translatable: false
default_value: { }
default_value_callback: ''
settings: { }
field_type: string

View File

@@ -0,0 +1,23 @@
uuid: ca060196-5d4d-4acc-9e6b-a7daf7af7003
langcode: en
status: true
dependencies:
config:
- field.storage.node.field_grappling_accuracy
- node.type.fighter
id: node.fighter.field_grappling_accuracy
field_name: field_grappling_accuracy
entity_type: node
bundle: fighter
label: 'Grappling Accuracy'
description: 'The grappling accuracy for this fighter.'
required: false
translatable: false
default_value: { }
default_value_callback: ''
settings:
min: null
max: null
prefix: ''
suffix: '%'
field_type: decimal

View File

@@ -0,0 +1,23 @@
uuid: 3a4c580f-fb39-4674-8533-a986ad57a7a4
langcode: en
status: true
dependencies:
config:
- field.storage.node.field_height
- node.type.fighter
id: node.fighter.field_height
field_name: field_height
entity_type: node
bundle: fighter
label: Height
description: 'The height of the fighter.'
required: false
translatable: false
default_value: { }
default_value_callback: ''
settings:
min: null
max: null
prefix: ''
suffix: ''
field_type: decimal

View File

@@ -0,0 +1,23 @@
uuid: bc39ff4d-12ca-47ff-9d0d-74a941148cf9
langcode: en
status: true
dependencies:
config:
- field.storage.node.field_knockdown_ratio
- node.type.fighter
id: node.fighter.field_knockdown_ratio
field_name: field_knockdown_ratio
entity_type: node
bundle: fighter
label: 'Knockdown Ratio'
description: 'The knockdown ratio for this fighter.'
required: false
translatable: false
default_value: { }
default_value_callback: ''
settings:
min: null
max: null
prefix: ''
suffix: ''
field_type: decimal

View File

@@ -0,0 +1,23 @@
uuid: d1f83a79-f899-49da-bd99-1a3e9ed7b34b
langcode: en
status: true
dependencies:
config:
- field.storage.node.field_knockouts
- node.type.fighter
id: node.fighter.field_knockouts
field_name: field_knockouts
entity_type: node
bundle: fighter
label: Knockouts
description: 'The amount of knockouts this fighter has.'
required: false
translatable: false
default_value: { }
default_value_callback: ''
settings:
min: null
max: null
prefix: ''
suffix: ''
field_type: decimal

View File

@@ -0,0 +1,19 @@
uuid: 493c9d57-a11f-4358-b618-8b3252da3d87
langcode: en
status: true
dependencies:
config:
- field.storage.node.field_last_name
- node.type.fighter
id: node.fighter.field_last_name
field_name: field_last_name
entity_type: node
bundle: fighter
label: 'Last Name'
description: 'Last name of the player.'
required: false
translatable: false
default_value: { }
default_value_callback: ''
settings: { }
field_type: string

View File

@@ -0,0 +1,23 @@
uuid: dcc0c063-f28b-4bc6-ba61-6fbdc70a8b70
langcode: en
status: true
dependencies:
config:
- field.storage.node.field_leg_reach
- node.type.fighter
id: node.fighter.field_leg_reach
field_name: field_leg_reach
entity_type: node
bundle: fighter
label: 'Leg Reach'
description: 'The leg reach of the fighter.'
required: false
translatable: false
default_value: { }
default_value_callback: ''
settings:
min: null
max: null
prefix: ''
suffix: ''
field_type: decimal

View File

@@ -0,0 +1,19 @@
uuid: 1c7f58ba-b19d-4016-b7bf-53e8c0c24e23
langcode: en
status: true
dependencies:
config:
- field.storage.node.field_losses
- node.type.fighter
id: node.fighter.field_losses
field_name: field_losses
entity_type: node
bundle: fighter
label: Losses
description: 'The amount of losses'
required: false
translatable: false
default_value: { }
default_value_callback: ''
settings: { }
field_type: string

View File

@@ -0,0 +1,28 @@
uuid: be611949-61fe-454a-9b5a-754ef77ff5f9
langcode: en
status: true
dependencies:
config:
- field.storage.node.field_player_photo
- media.type.image
- node.type.fighter
id: node.fighter.field_player_photo
field_name: field_player_photo
entity_type: node
bundle: fighter
label: 'Player Photo'
description: 'The player photos.'
required: false
translatable: false
default_value: { }
default_value_callback: ''
settings:
handler: 'default:media'
handler_settings:
target_bundles:
image: image
sort:
field: _none
auto_create: false
auto_create_bundle: ''
field_type: entity_reference

View File

@@ -0,0 +1,23 @@
uuid: e5c16d91-eb10-4d95-837f-279ccfb469d1
langcode: en
status: true
dependencies:
config:
- field.storage.node.field_reach
- node.type.fighter
id: node.fighter.field_reach
field_name: field_reach
entity_type: node
bundle: fighter
label: Reach
description: 'The reach of the fighter.'
required: false
translatable: false
default_value: { }
default_value_callback: ''
settings:
min: null
max: null
prefix: ''
suffix: ''
field_type: decimal

View File

@@ -0,0 +1,23 @@
uuid: 05529d7b-2702-4d98-953e-c38294bf1386
langcode: en
status: true
dependencies:
config:
- field.storage.node.field_strikes_per_minute
- node.type.fighter
id: node.fighter.field_strikes_per_minute
field_name: field_strikes_per_minute
entity_type: node
bundle: fighter
label: 'Strikes Per Minute'
description: 'The strikes per minute for this fighter.'
required: false
translatable: false
default_value: { }
default_value_callback: ''
settings:
min: null
max: null
prefix: ''
suffix: ''
field_type: decimal

View File

@@ -0,0 +1,23 @@
uuid: b32a72cf-325f-4abd-8234-6eb1b2d04628
langcode: en
status: true
dependencies:
config:
- field.storage.node.field_striking_accuracy
- node.type.fighter
id: node.fighter.field_striking_accuracy
field_name: field_striking_accuracy
entity_type: node
bundle: fighter
label: 'Striking Accuracy'
description: 'The striking accuracy for this fighter.'
required: false
translatable: false
default_value: { }
default_value_callback: ''
settings:
min: null
max: null
prefix: ''
suffix: '%'
field_type: decimal

View File

@@ -0,0 +1,23 @@
uuid: e1130f2d-f575-442f-8fbc-2dc11e45582b
langcode: en
status: true
dependencies:
config:
- field.storage.node.field_submissions
- node.type.fighter
id: node.fighter.field_submissions
field_name: field_submissions
entity_type: node
bundle: fighter
label: Submissions
description: 'The amount of submissions wins this fighter has.'
required: false
translatable: false
default_value: { }
default_value_callback: ''
settings:
min: null
max: null
prefix: ''
suffix: ''
field_type: decimal

View File

@@ -0,0 +1,23 @@
uuid: 2564e00a-2001-4dac-bf0f-b5a850ec78cc
langcode: en
status: true
dependencies:
config:
- field.storage.node.field_takedowns_per_15
- node.type.fighter
id: node.fighter.field_takedowns_per_15
field_name: field_takedowns_per_15
entity_type: node
bundle: fighter
label: 'Takedowns Per 15'
description: 'The takedowns per 15 minutes for this fighter.'
required: false
translatable: false
default_value: { }
default_value_callback: ''
settings:
min: null
max: null
prefix: ''
suffix: ''
field_type: decimal

View File

@@ -0,0 +1,19 @@
uuid: 7c6981ab-23b9-4407-8ef7-2f61d6561c4b
langcode: en
status: true
dependencies:
config:
- field.storage.node.field_ties
- node.type.fighter
id: node.fighter.field_ties
field_name: field_ties
entity_type: node
bundle: fighter
label: Ties
description: 'The amount of ties.'
required: false
translatable: false
default_value: { }
default_value_callback: ''
settings: { }
field_type: string

View File

@@ -0,0 +1,23 @@
uuid: 56f9ae5d-1ff2-40eb-9085-7657176f60cc
langcode: en
status: true
dependencies:
config:
- field.storage.node.field_weight
- node.type.fighter
id: node.fighter.field_weight
field_name: field_weight
entity_type: node
bundle: fighter
label: Weight
description: 'The weight of the fighter.'
required: false
translatable: false
default_value: { }
default_value_callback: ''
settings:
min: null
max: null
prefix: ''
suffix: ''
field_type: decimal

View File

@@ -0,0 +1,19 @@
uuid: ffde2285-42ba-4db5-9bc6-3ebe2124f2c6
langcode: en
status: true
dependencies:
config:
- field.storage.node.field_wins
- node.type.fighter
id: node.fighter.field_wins
field_name: field_wins
entity_type: node
bundle: fighter
label: Wins
description: 'The amount of wins.'
required: false
translatable: false
default_value: { }
default_value_callback: ''
settings: { }
field_type: string

View File

@@ -0,0 +1,21 @@
uuid: eac5bd54-7691-421e-8f2a-ce579c6d3032
langcode: en
status: true
dependencies:
config:
- field.storage.taxonomy_term.field_event_date
- taxonomy.vocabulary.ufc_events
module:
- datetime
id: taxonomy_term.ufc_events.field_event_date
field_name: field_event_date
entity_type: taxonomy_term
bundle: ufc_events
label: 'Event Date'
description: 'The date for this event.'
required: false
translatable: false
default_value: { }
default_value_callback: ''
settings: { }
field_type: datetime

View File

@@ -0,0 +1,20 @@
uuid: 9d6bf3c4-a280-4e14-a46e-2f0df3208242
langcode: en
status: true
dependencies:
module:
- node
id: node.field_absorbed_per_min
field_name: field_absorbed_per_min
entity_type: node
type: decimal
settings:
precision: 10
scale: 2
module: core
locked: false
cardinality: 1
translatable: true
indexes: { }
persist_with_no_fields: false
custom_storage: false

View File

@@ -0,0 +1,18 @@
uuid: 9302d680-0a5f-4846-bec7-72952ff45727
langcode: en
status: true
dependencies:
module:
- node
id: node.field_accuracy
field_name: field_accuracy
entity_type: node
type: float
settings: { }
module: core
locked: false
cardinality: 1
translatable: true
indexes: { }
persist_with_no_fields: false
custom_storage: false

View File

@@ -0,0 +1,20 @@
uuid: 6691c996-791a-4b93-9dca-5504091188a8
langcode: en
status: true
dependencies:
module:
- node
id: node.field_age
field_name: field_age
entity_type: node
type: decimal
settings:
precision: 10
scale: 2
module: core
locked: false
cardinality: 1
translatable: true
indexes: { }
persist_with_no_fields: false
custom_storage: false

View File

@@ -0,0 +1,20 @@
uuid: 88f41317-7b99-4916-9b62-2fc9574b4cb2
langcode: en
status: true
dependencies:
module:
- node
id: node.field_decisions
field_name: field_decisions
entity_type: node
type: decimal
settings:
precision: 10
scale: 2
module: core
locked: false
cardinality: 1
translatable: true
indexes: { }
persist_with_no_fields: false
custom_storage: false

View File

@@ -0,0 +1,20 @@
uuid: 27166575-3538-4b15-aaa0-5da43aaf609b
langcode: en
status: true
dependencies:
module:
- node
- taxonomy
id: node.field_division
field_name: field_division
entity_type: node
type: entity_reference
settings:
target_type: taxonomy_term
module: core
locked: false
cardinality: 1
translatable: true
indexes: { }
persist_with_no_fields: false
custom_storage: false

View File

@@ -0,0 +1,20 @@
uuid: f85fe501-9759-424f-ae4c-9c7120715c08
langcode: en
status: true
dependencies:
module:
- node
- taxonomy
id: node.field_event
field_name: field_event
entity_type: node
type: entity_reference
settings:
target_type: taxonomy_term
module: core
locked: false
cardinality: 1
translatable: true
indexes: { }
persist_with_no_fields: false
custom_storage: false

View File

@@ -0,0 +1,19 @@
uuid: a065856c-0d5f-4c0f-b744-338ad233aa23
langcode: en
status: true
dependencies:
module:
- node
id: node.field_fighter_one
field_name: field_fighter_one
entity_type: node
type: entity_reference
settings:
target_type: node
module: core
locked: false
cardinality: 1
translatable: true
indexes: { }
persist_with_no_fields: false
custom_storage: false

View File

@@ -0,0 +1,19 @@
uuid: 75c486ae-91c5-4672-818e-0f8a6e286b20
langcode: en
status: true
dependencies:
module:
- node
id: node.field_fighter_two
field_name: field_fighter_two
entity_type: node
type: entity_reference
settings:
target_type: node
module: core
locked: false
cardinality: 1
translatable: true
indexes: { }
persist_with_no_fields: false
custom_storage: false

View File

@@ -0,0 +1,21 @@
uuid: 28585605-54e4-49ca-9d74-468ceba7fafe
langcode: en
status: true
dependencies:
module:
- node
id: node.field_first_name
field_name: field_first_name
entity_type: node
type: string
settings:
max_length: 255
is_ascii: false
case_sensitive: false
module: core
locked: false
cardinality: 1
translatable: true
indexes: { }
persist_with_no_fields: false
custom_storage: false

View File

@@ -0,0 +1,20 @@
uuid: 519a3558-3dcd-4f40-a4e6-2bbc1d08be6b
langcode: en
status: true
dependencies:
module:
- node
id: node.field_grappling_accuracy
field_name: field_grappling_accuracy
entity_type: node
type: decimal
settings:
precision: 10
scale: 2
module: core
locked: false
cardinality: 1
translatable: true
indexes: { }
persist_with_no_fields: false
custom_storage: false

View File

@@ -0,0 +1,20 @@
uuid: 2c211457-b9ec-461f-86d6-a6c6f01eeef5
langcode: en
status: true
dependencies:
module:
- node
id: node.field_height
field_name: field_height
entity_type: node
type: decimal
settings:
precision: 10
scale: 2
module: core
locked: false
cardinality: 1
translatable: true
indexes: { }
persist_with_no_fields: false
custom_storage: false

View File

@@ -0,0 +1,20 @@
uuid: 7241aad9-0095-4b94-b056-0c0de56f5e8e
langcode: en
status: true
dependencies:
module:
- node
id: node.field_knockdown_ratio
field_name: field_knockdown_ratio
entity_type: node
type: decimal
settings:
precision: 10
scale: 2
module: core
locked: false
cardinality: 1
translatable: true
indexes: { }
persist_with_no_fields: false
custom_storage: false

View File

@@ -0,0 +1,20 @@
uuid: 5d0cc244-2044-4b3b-96be-8cd5ead4e1e4
langcode: en
status: true
dependencies:
module:
- node
id: node.field_knockouts
field_name: field_knockouts
entity_type: node
type: decimal
settings:
precision: 10
scale: 2
module: core
locked: false
cardinality: 1
translatable: true
indexes: { }
persist_with_no_fields: false
custom_storage: false

View File

@@ -0,0 +1,21 @@
uuid: 0c81c2da-1979-4b37-a29b-e0cdb78e8995
langcode: en
status: true
dependencies:
module:
- node
id: node.field_last_name
field_name: field_last_name
entity_type: node
type: string
settings:
max_length: 255
is_ascii: false
case_sensitive: false
module: core
locked: false
cardinality: 1
translatable: true
indexes: { }
persist_with_no_fields: false
custom_storage: false

View File

@@ -0,0 +1,20 @@
uuid: dc50d6bf-0642-480e-988e-e37390f192a4
langcode: en
status: true
dependencies:
module:
- node
id: node.field_leg_reach
field_name: field_leg_reach
entity_type: node
type: decimal
settings:
precision: 10
scale: 2
module: core
locked: false
cardinality: 1
translatable: true
indexes: { }
persist_with_no_fields: false
custom_storage: false

View File

@@ -0,0 +1,21 @@
uuid: 288335f6-1fff-4f29-a2af-70616c13c9ba
langcode: en
status: true
dependencies:
module:
- node
id: node.field_losses
field_name: field_losses
entity_type: node
type: string
settings:
max_length: 255
is_ascii: false
case_sensitive: false
module: core
locked: false
cardinality: 1
translatable: true
indexes: { }
persist_with_no_fields: false
custom_storage: false

View File

@@ -0,0 +1,20 @@
uuid: d35ea863-cf26-469d-bdaf-468b617483e2
langcode: en
status: true
dependencies:
module:
- media
- node
id: node.field_player_photo
field_name: field_player_photo
entity_type: node
type: entity_reference
settings:
target_type: media
module: core
locked: false
cardinality: 1
translatable: true
indexes: { }
persist_with_no_fields: false
custom_storage: false

View File

@@ -0,0 +1,21 @@
uuid: d6738d5c-af34-4bcb-b217-ff61904886d4
langcode: en
status: true
dependencies:
module:
- node
id: node.field_prediction
field_name: field_prediction
entity_type: node
type: string
settings:
max_length: 255
is_ascii: false
case_sensitive: false
module: core
locked: false
cardinality: 1
translatable: true
indexes: { }
persist_with_no_fields: false
custom_storage: false

View File

@@ -0,0 +1,20 @@
uuid: 712bd9dc-58d0-4bcc-b981-731b3a725220
langcode: en
status: true
dependencies:
module:
- node
id: node.field_reach
field_name: field_reach
entity_type: node
type: decimal
settings:
precision: 10
scale: 2
module: core
locked: false
cardinality: 1
translatable: true
indexes: { }
persist_with_no_fields: false
custom_storage: false

View File

@@ -0,0 +1,19 @@
uuid: f20d5d9f-d9a4-4644-b06a-e2d7c02ef5f3
langcode: en
status: true
dependencies:
module:
- node
id: node.field_result
field_name: field_result
entity_type: node
type: entity_reference
settings:
target_type: node
module: core
locked: false
cardinality: 1
translatable: true
indexes: { }
persist_with_no_fields: false
custom_storage: false

View File

@@ -0,0 +1,20 @@
uuid: 18a251e1-8568-4a45-960b-83b009d94a3b
langcode: en
status: true
dependencies:
module:
- node
id: node.field_strikes_per_minute
field_name: field_strikes_per_minute
entity_type: node
type: decimal
settings:
precision: 10
scale: 2
module: core
locked: false
cardinality: 1
translatable: true
indexes: { }
persist_with_no_fields: false
custom_storage: false

View File

@@ -0,0 +1,20 @@
uuid: 0f6e4cbd-8d76-4c5f-8c92-e6401f148a1d
langcode: en
status: true
dependencies:
module:
- node
id: node.field_striking_accuracy
field_name: field_striking_accuracy
entity_type: node
type: decimal
settings:
precision: 10
scale: 2
module: core
locked: false
cardinality: 1
translatable: true
indexes: { }
persist_with_no_fields: false
custom_storage: false

View File

@@ -0,0 +1,20 @@
uuid: 42853083-7298-43df-807c-607b7941505c
langcode: en
status: true
dependencies:
module:
- node
id: node.field_submissions
field_name: field_submissions
entity_type: node
type: decimal
settings:
precision: 10
scale: 2
module: core
locked: false
cardinality: 1
translatable: true
indexes: { }
persist_with_no_fields: false
custom_storage: false

View File

@@ -0,0 +1,20 @@
uuid: 970131d2-174b-4e75-a873-937abab255e7
langcode: en
status: true
dependencies:
module:
- node
id: node.field_takedowns_per_15
field_name: field_takedowns_per_15
entity_type: node
type: decimal
settings:
precision: 10
scale: 2
module: core
locked: false
cardinality: 1
translatable: true
indexes: { }
persist_with_no_fields: false
custom_storage: false

View File

@@ -0,0 +1,21 @@
uuid: 73d01cd2-072a-4cc9-b96c-3fa3164124bc
langcode: en
status: true
dependencies:
module:
- node
id: node.field_ties
field_name: field_ties
entity_type: node
type: string
settings:
max_length: 255
is_ascii: false
case_sensitive: false
module: core
locked: false
cardinality: 1
translatable: true
indexes: { }
persist_with_no_fields: false
custom_storage: false

View File

@@ -0,0 +1,20 @@
uuid: 2cff8ca8-3632-4104-ba8f-caf2f3d91394
langcode: en
status: true
dependencies:
module:
- node
id: node.field_weight
field_name: field_weight
entity_type: node
type: decimal
settings:
precision: 10
scale: 2
module: core
locked: false
cardinality: 1
translatable: true
indexes: { }
persist_with_no_fields: false
custom_storage: false

View File

@@ -0,0 +1,21 @@
uuid: 82eb82a9-7025-4857-bcd2-efa273514971
langcode: en
status: true
dependencies:
module:
- node
id: node.field_wins
field_name: field_wins
entity_type: node
type: string
settings:
max_length: 255
is_ascii: false
case_sensitive: false
module: core
locked: false
cardinality: 1
translatable: true
indexes: { }
persist_with_no_fields: false
custom_storage: false

View File

@@ -0,0 +1,20 @@
uuid: b46f481d-6eda-4bba-ae10-03c0af640edf
langcode: en
status: true
dependencies:
module:
- datetime
- taxonomy
id: taxonomy_term.field_event_date
field_name: field_event_date
entity_type: taxonomy_term
type: datetime
settings:
datetime_type: date
module: datetime
locked: false
cardinality: 1
translatable: true
indexes: { }
persist_with_no_fields: false
custom_storage: false

View File

@@ -0,0 +1,18 @@
uuid: 58dd5a4f-c2b6-490c-8d82-109621022e9a
langcode: en
status: true
dependencies:
module:
- menu_ui
third_party_settings:
menu_ui:
available_menus:
- main
parent: 'main:'
name: Fight
type: fight
description: 'A fight between two fighters.'
help: ''
new_revision: true
preview_mode: 1
display_submitted: false

View File

@@ -0,0 +1,18 @@
uuid: 8af5329d-7e64-4606-b474-e623bdc143d3
langcode: en
status: true
dependencies:
module:
- menu_ui
third_party_settings:
menu_ui:
available_menus:
- main
parent: 'main:'
name: Fighter
type: fighter
description: 'A fighter.'
help: ''
new_revision: true
preview_mode: 1
display_submitted: false

View File

@@ -0,0 +1,23 @@
uuid: 4ab9533e-d5c9-4583-8d1a-ee3b74c91eef
langcode: en
status: true
dependencies:
module:
- node
id: fights
label: Fights
type: 'canonical_entities:node'
pattern: '/fight/[node:title]'
selection_criteria:
9022da84-04b3-4e0c-9d1a-0c8d1d17e6fc:
id: 'entity_bundle:node'
negate: false
uuid: 9022da84-04b3-4e0c-9d1a-0c8d1d17e6fc
context_mapping:
node: node
bundles:
fight: fight
selection_logic: and
weight: -5
relationships: { }

View File

@@ -0,0 +1,8 @@
uuid: 651c73cc-63b1-462a-8286-b292e4badaab
langcode: en
status: true
dependencies: { }
name: 'UFC Divisions'
vid: ufc_divisions
description: 'The different divisions in the UFC'
weight: 0

View File

@@ -0,0 +1,8 @@
uuid: 06ce81ea-6364-4844-a8a0-4fec95ada9a0
langcode: en
status: true
dependencies: { }
name: 'UFC Events'
vid: ufc_events
description: 'List of events.'
weight: 0

View File

@@ -0,0 +1,18 @@
fight_weights:
wins: 1
losses: 1
age: 1
height: 1
weight: 1
reach: 1
leg_reach: 1
knockouts: 1
decisions: 1
submissions: 1
striking_accuracy: 1
grappling_accuracy: 1
strikes_per_min: 1
absorbed_per_min: 1
takedowns_per_15: 1
knockout_ratio: 1
knockout_pct: 1

View File

@@ -0,0 +1,24 @@
Felder vs. Dos Anjos
Morono vs. Mckee
Reyes vs. Blachowicz
Kara France vs. Royval
Young vs. Klein
Sanchez vs. Matthews
Perry vs. Means
Rodriguez vs. Dalby
Rothwell vs. Tybura
Cosce vs. Palatnikov
Taha vs. Barcelos
Wiman vs. Leavitt
Felder vs. Dos Anjos
Morono vs. Mckee
Reyes vs. Blachowicz
Kara France vs. Royval
Young vs. Klein
Sanchez vs. Matthews
Perry vs. Means
Rodriguez vs. Dalby
Jouban vs. Gooden
Rothwell vs. Tybura
Cosce vs. Palatnikov
Taha vs. Barcelos

View File

@@ -0,0 +1,313 @@
<?php
namespace Drupal\ufc;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Drupal\ufc\Fighter;
use Drupal\node\Entity\Node;
use Drupal\Core\Entity\EntityTypeManager;
use Drupal\Core\Config\ConfigFactory;
class FightPredictor {
/**
* First Fighter.
*
* @var Drupal\node\Entity\Node
*/
protected $fighterOne;
/**
* Second Fighter.
*
* @var Drupal\node\Entity\Node
*/
protected $fighterTwo;
/**
* Entity Type Manager.
*
* @var Drupal\Core\Entity\EntityTypeManager
*/
protected $entityTypeManager;
/**
* Config for ufc weights.
*
* @var Drupal\Core\Config\ConfigFactory
*/
protected $config;
/**
* Weights config object.
*
* @var Drupal\Core\Config\ConfigFactory
*/
protected $weights;
/**
* Public constructor.
*/
public function __construct(EntityTypeManager $entityTypeManager, ConfigFactory $config) {
$this->entityTypeManager = $entityTypeManager;
$this->config = $config->getEditable('ufc.weights');
$this->weights = $config->getEditable('ufc.weights')->get('fight_weights');
}
/**
* The results of the fight.
*
* @var array
*/
protected $results = [
'fighter_one' => [
'name' => null,
'points' => 0,
'advantages' => [],
'disadvantages' => []
],
'fighter_two' => [
'name' => null,
'points' => 0,
'advantages' => [],
'disadvantages' => []
],
'skips' => 0
];
/**
* The amount of categories skipped.
*
* @var int
*/
protected $skipCount;
/**
* Calculate the fight results.
*/
public function calculate(Node $fighter_one, Node $fighter_two) {
// Reset skip count.
$this->skipCount = 0;
// First Fighter.
$this->fighterOne = $fighter_one;
// Second Fighter.
$this->fighterTwo = $fighter_two;
// Run the fight.
$this->runFight();
// Label the results array.
$this->results['fighter_one']['name'] = $fighter_one->label();
$this->results['fighter_two']['name'] = $fighter_two->label();
// Add total skips.
$this->results['skips'] = $this->skipCount;
// echo "<pre>";
// print_r($this->results);
// echo "</pre>";
// exit();
return $this->results;
}
/**
* Populate fight results.
*
* @return void
*/
public function runFight() {
$points = 0;
$this->calcComparativePoints();
}
/**
* Calculate comparative points.
*
* @return void
*/
public function calcComparativePoints() {
$this->calculateDiff('field_height', 'height');
$this->calculateDiff('field_weight', 'weight');
$this->calculateDiff('field_age', 'age');
$this->calculateDiff('field_reach', 'reach');
$this->calculateDiff('field_leg_reach', 'leg_reach');
$this->calculateDiff('field_wins', 'wins');
$this->calculateDiff('field_losses', 'losses', TRUE);
$this->calculateDiff('field_ties', 'ties');
$this->calculateDiff('field_decisions', 'decisions');
$this->calculateDiff('field_knockouts', 'knockouts');
$this->calculateDiff('field_submissions', 'submissions');
$this->calculateDiff('field_grappling_accuracy', 'grappling_accuracy');
$this->calculateDiff('field_striking_accuracy', 'striking_accuracy');
$this->calculateDiff('field_strikes_per_minute', 'strikes_per_minute');
$this->calculateDiff('field_absorbed_per_min', 'absorbed_per_min', TRUE);
$this->calculateDiff('field_takedowns_per_15', 'takedowns_per_15');
$this->calculateDiff('field_knockdown_ratio', 'knockdown_ratio');
}
/**
* Calculate the weighted diff between two fighters.
*
* @param [type] $field
* @param [type] $weight_label
* @return void
*/
public function calculateDiff($field, $weight_label, $inverse = FALSE) {
$f1 = $this->getFieldValue($field, $this->fighterOne);
$f2 = $this->getFieldValue($field, $this->fighterTwo);
if (empty($f1) || empty($f2)) {
$this->skipCount += 1;
return;
}
$weighted_points = 1 * $this->config->get('fight_weights')[$weight_label];
if ($f1 === $f2) {
$this->skipCount += 1;
return;
}
if ($inverse) {
if ($f1 < $f2) {
$this->results['fighter_one']['points'] += $weighted_points;
$this->results['fighter_one']['advantages'][] = $field;
$this->results['fighter_two']['disadvantages'][] = $field;
return;
}
elseif ($f1 > $f2) {
$this->results['fighter_two']['points'] += $$weighted_points;
$this->results['fighter_two']['advantages'][] = $field;
$this->results['fighter_one']['disadvantages'][] = $field;
return;
}
}
else {
if ($f1 > $f2) {
$this->results['fighter_one']['points'] += $weighted_points;
$this->results['fighter_one']['advantages'][] = $field;
$this->results['fighter_two']['disadvantages'][] = $field;
}
elseif ($f1 < $f2) {
$this->results['fighter_two']['points'] += $weighted_points;
$this->results['fighter_two']['advantages'][] = $field;
$this->results['fighter_one']['disadvantages'][] = $field;
}
}
}
/**
* Get value from a field.
*/
public function getFieldValue($field, Node $fighter) {
$field_values = reset($fighter->get($field)->getValue());
if (empty($field_values['value'])) {
return 0;
}
return (float) $field_values['value'];
}
/**
* Calculate the knockout percentage for a fighter.
*
* @param Node $fighter
* @return void
*/
public function getKnockoutPercentage(Node $fighter) {
$total_fights =
$this->getFieldValue('field_wins', $fighter) +
$this->getFieldValue('field_losses', $fighter) +
$this->getFieldValue('field_ties', $fighter);
$knockout_pct = $this->getFieldValue('field_knockouts', $fighter) / $total_fights;
return $knockout_pct;
}
/**
* Update predictions for all fights in batches
*/
public function updatePredictionsBatched($fights, &$context) {
// $fights = $this->entityTypeManager->getStorage('node')->loadByProperties(['type' => 'fight']);
$results = [];
foreach ($fights as $fight) {
\Drupal::logger('ufc')->notice("Starting " . $fight->label() . "");
$fight->save();
$results[] = $fight->id();
}
$context['results'] = $results;
}
/**
* Update predictions for all fights.
*/
public function updatePredictions() {
$fights = $this->entityTypeManager->getStorage('node')->loadByProperties(['type' => 'fight']);
// $count = 0;
foreach ($fights as $fight) {
\Drupal::logger('ufc')->notice("Starting " . $fight->label() . "");
$fight->save();
// if ($count == 4) {
// return;
// }
// $count++;
}
}
public function adjustWeights($adv, $dis_adv) {
foreach ($adv as $cat_to_increase) {
$clean = str_replace('field_', '', $cat_to_increase);
$this->adjustWeight($clean, 2);
}
foreach ($dis_adv as $cat_to_decrease) {
$clean = str_replace('field_', '', $cat_to_decrease);
$this->adjustWeight($clean, -1);
}
}
/**
* Helper function to increase the weight of a category.
*/
public function adjustWeight($key, $increment) {
$current_val = $this->config->get('fight_weights')[$key];
$increase = $current_val + $increment;
$target = 'fight_weights.' . $key;
$this->config->set($target, $increase)->save();
}
/**
* Helper function to reset all weighting.
*
* @return void
*/
public function resetWeights() {
foreach ($this->config->get('fight_weights') as $cat => $weight) {
$this->config->set('fight_weights.' . $cat, 1)->save();
}
}
public function fightUpdatedCallback($success, $results, $operations) {
// The 'success' parameter means no fatal PHP errors were detected. All
// other error management should be handled using 'results'.
if ($success) {
$message = \Drupal::translation()->formatPlural(
count($results),
'One fight processed.', '@count fight processed.'
);
}
else {
$message = t('Finished with an error.');
}
drupal_set_message($message);
}
}

View File

@@ -0,0 +1,511 @@
<?php
namespace Drupal\ufc;
use Drupal\media\Entity\Media;
use Drupal\node\Entity\Node;
use Drupal\Component\Utility\Html;
use GuzzleHttp\Client;
use Drupal\taxonomy\Entity\Term;
class Fighter {
public $name;
public $first_name;
public $last_name;
public $height;
public $weight;
public $age;
public $reach;
public $leg_reach;
public $image;
public $image_id;
public $class;
public $wins;
public $losses;
public $ties;
public $http_client;
public $fighter_page;
public $striking_accuracy;
public $grappling_accuracy;
public $strikes_per_min;
public $absorbed_per_min;
public $takedowns_per_15;
public $knockdown_ratio;
public $knockouts;
public $decisions;
public $submissions;
/**
* Public constructor.
*
* @param Client $httpClient
*/
public function __construct(Client $httpClient) {
$this->http_client = $httpClient;
}
/**
* Get fighters url from name.
*
* @return string
*/
public function getFighterUrl() {
// Manual overrides for name problems go here.
if ($this->first_name == 'Khaos') {
$this->first_name = 'Kalinn';
}
if ($this->first_name == 'J') {
$this->first_name = 'JP';
$this->last_name = 'Buys';
}
if ($this->last_name == 'Mc Kee') {
$this->last_name = 'McKee';
}
if ($this->last_name == 'Mc Gee') {
$this->last_name = 'McGee';
}
if ($this->last_name == 'Mc Gregor') {
$this->last_name = 'mcgregor';
}
if ($this->last_name == "O&#039; Malley") {
$this->last_name = 'Omalley';
}
if ($this->first_name == "Don&#039;") {
$this->first_name = 'dontale';
$this->last_name = 'mayes';
}
if ($this->first_name == "Marc-") {
$this->first_name = 'Marc';
}
if ($this->first_name == "A") {
$this->first_name = 'AJ';
$this->last_name = 'Dobson';
}
if ($this->first_name == "C") {
$this->first_name = 'CB';
$this->last_name = 'Dollaway';
}
if ($this->last_name == "Della Maddalena") {
$this->last_name = 'Della';
}
if ($this->first_name == "Elizeudos") {
$this->first_name = 'elizeu';
$this->last_name = 'dos-santos';
}
if ($this->last_name == "La Flare") {
$this->last_name = 'laflare';
}
if ($this->first_name == "JoelÁlvarez") {
$this->first_name = 'Joel';
}
if ($this->last_name == "J Brown") {
$this->first_name = 'TJ';
$this->last_name = 'Brown';
}
if ($this->first_name == "Alexda") {
$this->first_name = "alex-da";
}
if ($this->last_name == "Mc Kinney") {
$this->last_name = "mckinney";
}
if ($this->last_name == "Van Camp") {
$this->last_name = "vancamp";
}
if ($this->last_name == "J Laramie") {
$this->first_name = "TJ";
$this->last_name = "Laramie";
}
if ($this->last_name == "Al- Qaisi") {
$this->last_name = "alqaisi";
}
if ($this->first_name == "Alatengheili") {
$this->first_name = "heili";
$this->last_name = "alateng";
}
if ($this->last_name == "J Dillashaw") {
$this->first_name = "TJ";
$this->last_name = "Dillashaw";
}
if ($this->first_name == "Andersondos") {
$this->first_name = "Anderson-dos";
}
if ($this->last_name == "Silvade Andrade") {
$this->last_name = "Silva-de-andrade";
}
if ($this->first_name == "Ode&#039;") {
$this->first_name = "ode";
}
if ($this->first_name == "Sumudaerji") {
$this->first_name = "su";
$this->last_name = "mudaerji";
}
$hyphens = str_replace(" ", "-", $this->last_name);
$suffix = $this->first_name . "-" . $hyphens;
if ($this->first_name == "Aoriqileng") {
$suffix = $this->first_name;
}
$url = "https://www.ufc.com/athlete/$suffix";
$trim = rtrim($url);
return $url;
}
/**
* Get contents of the fighter page.
*
* @return void
*/
public function getFighterPage() {
try {
$request = $this->http_client->request('GET', $this->getFighterUrl(), ['verify' => FALSE]);
$this->fighter_page = $request->getBody()->getContents();
} catch (\Exception $e) {
echo 'Caught exception: ', $e->getMessage(), "\n";
// exit();
}
/*
USE THIS FOR TESTING:
$player_url = "https://www.ufc.com/athlete/anthony-hamilton";
try {
$request = $this->http_client->request('GET', $player_url);
}
catch (\Exception $e) {
return FALSE;
}
$content = $request->getBody()->getContents();
*/
}
/**
* Get fighter age.
*
* @return void
*/
public function getAge() {
$pattern = '/<div class="field field--name-age(.*)<\/div>/';
preg_match($pattern, $this->fighter_page, $matches);
preg_match_all('!\d+!', $matches[0], $age);
$fighter_age = reset($age[0]);
$this->age = (float) $fighter_age;
}
public function getBio() {
$pattern = '/<div class="c-bio__text">[0-9]+\.[0-9]+/s';
preg_match_all($pattern, $this->fighter_page, $matches);
$matches = reset($matches);
// Get height.
$pattern = '/[0-9]+\.[0-9]+/';
preg_match($pattern, $matches[0], $height);
$this->height = reset($height);
// Get weight.
$pattern = '/[0-9]+\.[0-9]+/';
preg_match($pattern, $matches[1], $weight);
$this->weight = reset($weight);
// Get reach.
$pattern = '/[0-9]+\.[0-9]+/';
preg_match($pattern, $matches[2], $reach);
$this->reach = reset($reach);
// Get leg reach.
$pattern = '/[0-9]+\.[0-9]+/';
preg_match($pattern, $matches[3], $leg_reach);
$this->leg_reach = reset($leg_reach);
}
/**
* Extracts the fighter record.
*
* @return void
*/
public function getFighterRecord() {
$pattern = "/[0-9]+[-][0-9]+[-][0-9]+.\(W-L-D\)/";
preg_match($pattern, $this->fighter_page, $matches);
$r = reset($matches);
$r = str_replace(" (W-L-D)", "", $r);
$record_chunks = explode("-", $r);
$this->wins = $record_chunks[0];
$this->losses = $record_chunks[1];
$this->ties = $record_chunks[2];
}
/**
* Extracts the striking accuracy.
*
* @return void
*/
public function getStrikingAccuracy() {
$pattern = '/<title>Striking accuracy.(.*)<\/title>/';
preg_match($pattern, $this->fighter_page, $matches);
$this->striking_accuracy = str_replace('%', '', $matches[1]);
}
/**
* Extracts the grappling accuracy.
*
* @return void
*/
public function getGrapplingAccuracy() {
$pattern = '/<title>Grappling accuracy.(.*)<\/title>/';
preg_match($pattern, $this->fighter_page, $matches);
$this->grappling_accuracy = str_replace('%', '', $matches[1]);
}
/**
* Extracts averages from the statistics section.
*
* @return void
*/
public function getAverages() {
$pattern = '/<div class="c-stat-compare__group-1(.*)(<\/div>)/sU';
preg_match_all($pattern, $this->fighter_page, $matches);
$this->strikes_per_min = $this->extractNumber($matches[1][0]);
$this->takedowns_per_15 = $this->extractNumber($matches[1][1]);
$this->knockdown_ratio = $this->extractNumber($matches[1][3]);
$pattern = '/<div class="c-stat-compare__group-2(.*)(<\/div>)/sU';
preg_match_all($pattern, $this->fighter_page, $matches);
$this->absorbed_per_min = $this->extractNumber($matches[1][0]);
}
/**
* Extracts wins per type.
*
* @return void
*/
public function getWinsBreakdown() {
$pattern = '/<div class="c-stat-3bar__value">(.*)<\/div>/sU';
preg_match_all($pattern, $this->fighter_page, $matches);
$this->knockouts = $this->extractWinByType($matches[0][3]);
$this->decisions = $this->extractWinByType($matches[0][4]);
$this->submissions = $this->extractWinByType($matches[0][5]);
}
/**
* Helper to get number out of string.
*
* @param [type] $string
* @return void
*/
protected function extractNumber($string) {
$no_tags = strip_tags($string);
preg_match_all('!\d+!', $no_tags, $matches);
$number = implode('.', $matches[0]);
return $number;
}
/**
* Helper to extract number from number and percentage.
*
* @param [type] $string
* @return void
*/
protected function extractWinByType($string) {
$no_tags = strip_tags($string);
preg_match_all('!\d+!', $no_tags, $matches);
return $matches[0][0];
}
/**
* Creates a player node.
*
* @return void
*/
public function createPlayerNode() {
$division_id = self::transformWeightClass();
$title = $this->first_name . " " . $this->last_name;
$node = Node::create([
'type' => 'fighter',
'title' => $title,
'field_division' => self::getTermByName($division_id),
'field_first_name' => $this->first_name,
'field_last_name' => $this->last_name,
'field_wins' => $this->wins,
'field_losses' => $this->losses,
'field_ties' => $this->ties,
'field_player_photo' => [
'target_id' => $this->image_id,
],
'field_striking_accuracy' => $this->striking_accuracy,
'field_grappling_accuracy' => $this->grappling_accuracy,
'field_strikes_per_minute' => $this->strikes_per_min,
'field_absorbed_per_min' => $this->absorbed_per_min,
'field_takedowns_per_15' => $this->takedowns_per_15,
'field_knockdown_ratio' => $this->knockdown_ratio,
'field_knockouts' => $this->knockouts,
'field_decisions' => $this->decisions,
'field_submissions' => $this->submissions,
'field_age' => $this->age,
'field_reach' => $this->reach,
'field_leg_reach' => $this->leg_reach,
'field_height' => $this->height,
'field_weight' => $this->weight
]);
$node->status = 1;
$node->enforceIsNew();
$node->save();
}
/**
* Updates a player node.
*
* @param $nid
* @return void
*/
public function updatePlayerNode($nid) {
$node_storage = \Drupal::entityTypeManager()->getStorage('node');
$node = $node_storage->load($nid);
$node->field_wins = $this->wins;
$node->field_losses = $this->losses;
$node->field_ties = $this->ties;
$node->field_striking_accuracy = $this->striking_accuracy;
$node->field_grappling_accuracy = $this->grappling_accuracy;
$node->field_strikes_per_minute = $this->strikes_per_min;
$node->field_absorbed_per_min = $this->absorbed_per_min;
$node->field_takedowns_per_15 = $this->takedowns_per_15;
$node->field_knockdown_ratio = $this->knockdown_ratio;
$node->field_knockouts = $this->knockouts;
$node->field_decisions = $this->decisions;
$node->field_submissions = $this->submissions;
$node->field_age = $this->age;
$node->field_reach = $this->reach;
$node->field_leg_reach = $this->leg_reach;
$node->field_height = $this->height;
$node->field_weight = $this->weight;
$node->save();
}
/**
* Helper function to transform the weight class.
*
* @return void
*/
public function transformWeightClass() {
$weight_class = $this->class;
$stripped = str_replace("_", " ", $weight_class);
$upper = ucwords($stripped);
return $upper;
}
/**
* Helper function to retrieve taxo term by name.
*
* @param [type] $term_name
* @return void
*/
public function getTermByName($term_name) {
// Get taxonomy term storage.
$taxonomyStorage = \Drupal::service('entity.manager')->getStorage('taxonomy_term');
// Set name properties.
$properties['name'] = $term_name;
$properties['vid'] = 'ufc_divisions';
// Load taxonomy term by properties.
$terms = $taxonomyStorage->loadByProperties($properties);
$term = reset($terms);
if (!$term) {
$new_term = Term::create([
'name' => $term_name,
'vid' => 'ufc_divisions'
])->save();
return $new_term;
};
return $term->id();
}
/**
* Create media for the player headshot.
*
* @return void
*/
public function createMediaEntityFromImage() {
$file_name = self::extractFileName();
if (empty($file_name)) {
$rand = rand(0,100000000) . '.png';
$file_name = "default-headshot_$rand";
}
if (!empty($this->image)) {
$file_data = file_get_contents($this->image);
}
if (empty($file_data)) {
$file_data = file_get_contents("public://player-headshots/headshot-default.png");
}
$file = file_save_data(
$file_data,
"public://player-headshots/$file_name", FILE_EXISTS_RENAME);
$media_image = Media::create([
'bundle' => 'image',
'name' => $file_name,
'field_media_image' => [
'target_id' => $file->id(),
],
]);
$media_image->save();
$this->image_id = $media_image->id();
}
/**
* Helper to extract file name for images.
*
* @return void
*/
public function extractFilename() {
if (!empty($this->image)) {
preg_match('/[A-Z_0-9]*.png/', $this->image, $matches);
$file_name = reset($matches);
return $file_name;
}
return FALSE;
}
}

View File

@@ -0,0 +1,202 @@
<?php
namespace Drupal\ufc;
use Drupal\Core\Entity\EntityTypeManager;
use Drupal\media\Media;
use Drupal\ufc\Fighter;
use GuzzleHttp\Client;
class FighterImporter {
protected $http_client;
protected $entity_type_manager;
protected $fighters = [];
protected $weight_class;
// The base url for fighter lists.
const UFC_BASE = "https://www.ufc.com/athletes/all?filters%5B0%5D=status%3A23&filters%5B1%5D=weight_class%3";
// These are the filter values used to cycle through divisions.
protected $divisions = [
'heavyweight' => "A11",
'light_heavyweight' => "A13",
'middleweight' => "A14",
'welterweight' => "A15",
'lightweight' => "A12",
'featherweight' => "A9",
'bantamweight' => "A8",
'flyweight' => "A10",
'strawweight' => "A99",
];
/**
* Public constructor for Fighter Importer.
*
* @param Client $httpClient
* @param EntityTypeManager $entityTypeManager
*/
public function __construct(Client $httpClient, EntityTypeManager $entityTypeManager) {
$this->http_client = $httpClient;
$this->entity_type_manager = $entityTypeManager;
}
public function importFighters() {
// This will populate fighters array.
$fighters_by_div = self::getListOfCurrentFighters();
// Process each fighter into system.
foreach ($fighters_by_div as $division => $fighters) {
foreach ($fighters as $fighter_data) {
$fighter = new Fighter($this->http_client);
$fighter->first_name = $fighter_data['firstname'];
$fighter->last_name = $fighter_data['lastname'];
$fighter->image = $fighter_data['image'];
$fighter->class = $division;
$fighter->getFighterPage();
$fighter->getAge();
$fighter->getBio();
$fighter->getFighterRecord();
$fighter->getStrikingAccuracy();
$fighter->getGrapplingAccuracy();
$fighter->getAverages();
$fighter->getWinsBreakdown();
$fighter->createMediaEntityFromImage();
// Check if node exists, by title.
$title = $fighter->first_name . " " . $fighter->last_name;
$node_lookup = reset($this->entity_type_manager->getStorage('node')->loadByProperties(['title' => $title]));
if (!empty($node_lookup)) {
// Update instead of create.
$fighter->updatePlayerNode($node_lookup->id());
\Drupal::logger('ufc')->notice($fighter_data['firstname'] . " " . $fighter_data['lastname'] . " updated successfully.");
}
else {
echo "didnt find an existing player, creating new for " . $title;
$fighter->createPlayerNode();
\Drupal::logger('ufc')->notice($fighter_data['firstname'] . " " . $fighter_data['lastname'] . " imported successfully.");
}
}
}
}
/**
* Get list of current fighters.
*
* @return array $fighters
*/
public function getListOfCurrentFighters() {
foreach ($this->divisions as $division => $div_base_url) {
$division_url = self::UFC_BASE . $div_base_url;
$this->weight_class = $division;
echo "Starting import for " . $division . "\n";
self::loopThroughFighterPages($division_url);
}
return $this->fighters;
}
/**
* There is a pager, loop through to get all fighters.
*
* @param string $base_url
*/
public function loopThroughFighterPages($base_url) {
for ($i=0; $i<=20; $i++) {
$url = $base_url . "&page=$i";
$request = $this->http_client->request('GET', $url, ['verify' => false]);
$content = $request->getBody()->getContents();
$check = strpos($content, "No Result Found For");
if (!$check) {
echo "extracting fighters from page $i \n";
self::extractFighters($content);
continue;
}
break;
}
}
/**
* Extract fighters from a page.
*/
public function extractFighters($input) {
$pattern = '/<span class="c-listing-athlete__name">(.*)<\/span>/sU';
preg_match_all($pattern, $input, $matches);
$fighter_names = [];
foreach ($matches[1] as $fighter_name) {
$fighter_names[] = trim(html_entity_decode($fighter_name));
}
$fighter_names = array_unique($fighter_names);
foreach ($fighter_names as $name) {
$name_no_spaces = str_replace(" ", "", $name);
$class_exists = array_key_exists($this->weight_class, $this->fighters);
$fighter_exists = null;
if ($class_exists) {
$fighter_exists = array_key_exists($name_no_spaces, $this->fighters[$this->weight_class]);
}
if (!$fighter_exists) {
$chunks = preg_split('/(?=[A-Z])/', $name_no_spaces);
$first_name = $chunks[1];
$last_name_size = count($chunks);
switch($last_name_size) {
case 3:
$last_name = $chunks[2];
break;
case 4:
$last_name = $chunks[2] . " " . $chunks[3];
break;
case 5:
$last_name = $chunks[2] . " " . $chunks[3] . " " . $chunks[4];
break;
}
$this->fighters[$this->weight_class][$name_no_spaces]['firstname'] = $first_name;
$this->fighters[$this->weight_class][$name_no_spaces]['lastname'] = $last_name;
}
// Get image paths.
$pattern = '/<div class="c-listing-athlete__thumbnail(.*)<\/div>/sU';
preg_match_all($pattern, $input, $matches);
$images = [];
foreach ($matches[0] as $html_img) {
$images[] = $this->extractImageSource($html_img);
}
$name = strtoupper($last_name . '_' . $first_name);
$fighter_image = $this->getFighterImageFromList($images, $name);
$this->fighters[$this->weight_class][$name_no_spaces]['image'] = $fighter_image;
}
}
// Get the fighter image.
public function extractImageSource($source_html) {
$pattern = '/<img[^>]+src="([^">]+)"/';
preg_match_all($pattern, $source_html, $image);
return $image[1];
}
// Extract a specific fighter image from a list.
public function getFighterImageFromList($list, $fighter) {
foreach ($list as $url_arr) {
foreach ($url_arr as $url) {
if (strpos($url, $fighter) !== FALSE) {
return $url;
}
}
}
return FALSE;
}
}

View File

@@ -0,0 +1,54 @@
<?php
namespace Drupal\ufc\Form;
use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
/**
* Class SelfHealKickoffForm to start self heal in batches.
*
* @package Drupal\ufc\Form
*/
class SelfHealKickoffForm extends FormBase {
/**
* {@inheritdoc}
*/
public function getFormId() {
return 'self_heal_kickoff_form';
}
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state) {
$form['self_heal'] = array(
'#type' => 'submit',
'#value' => $this->t('Self Heal'),
);
return $form;
}
/**
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state) {
$fights = \Drupal::service('entity_type.manager')->getStorage('node')->loadByProperties(['type' => 'fight']);
$batch = array(
'title' => t('Updating Fights...'),
'operations' => array(
array(
'\Drupal\ufc\FightPredictor::updatePredictionsBatched',
array($fights)
),
),
'finished' => '\Drupal\ufc\FightPredictor::fightUpdatedCallback',
);
batch_set($batch);
}
}

View File

@@ -0,0 +1,5 @@
name: UFC
description: Various handling for UFC
core_version_requirement: ^9 || ^10
type: module
package: Predictor

View File

@@ -0,0 +1,168 @@
<?php
use Drupal\node\Entity\Node;
use Drupal\Core\Entity\EntityInterface;
use Drupal\views\ViewExecutable;
use Drupal\Core\Render\Markup;
/**
* Implements hook_theme().
*
* Register a module or theme's theme implementations.
* The implementations declared by this hook specify how a particular render array is to be rendered as HTML.
*
* See: https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Render%21theme.api.php/function/hook_theme/8.2.x
*
* If you change this method, clear theme registry and routing table 'drush cc theme-registry' and 'drush cc router'.
*/
function ufc_theme($existing, $type, $theme, $path) {
return [
// Name of the theme hook.
'ufc_fight' => [
'render element' => 'children',
// If no template name is defined here, it defaults to the name of the theme hook, ie. module-name-theme-hook.html.twig
'template' => 'ufc-fight',
// Optionally define path to Twig template files. Defaults to the module's ./templates/ directory.
'path' => $path . '/templates',
// Optionally define variables that will be passed to the Twig template and set default values for them.
'variables' => [
'fighter_1' => [],
'fighter_2' => [],
],
],
];
}
/**
* Implements hook_entity_presave().
*/
function ufc_entity_presave(Drupal\Core\Entity\EntityInterface $entity) {
return;
$bundle = $entity->bundle();
if ($bundle === 'fight') {
// Get fighter ids, pass to predictor.
$f1_id = $entity->get('field_fighter_one')->getValue()[0]['target_id'];
$f2_id = $entity->get('field_fighter_two')->getValue()[0]['target_id'];
updatePrediction($f1_id, $f2_id, $entity);
}
}
/**
* Implements hook_cron().
*/
function ufc_cron() {
// Reset the file.
// file_put_contents("./modules/custom/ufc/fights_output.txt", "");
// Run through predictions.
// \Drupal::service("ufc.predictor")->updatePredictions();
// // Check for lines in file to see incorrect fights.
// $file_check = file("./modules/custom/ufc/fights_output.txt");
// echo '<pre>';
// print_r($file_check);
// echo '</pre>';
// exit();
}
/**
* Updates the prediction field on save.
*
* @param int $f1
* @param int $f2
* @return void
*/
function updatePrediction($f1, $f2, EntityInterface $entity) {
return;
if (!$f1 || !$f2) {
return;
}
$fighter_one = Node::load($f1);
$fighter_two = Node::load($f2);
$predictor = \Drupal::service('ufc.predictor');
$results = $predictor->calculate($fighter_one, $fighter_two);
$prediction = '';
$fight_points = [
$results['fighter_one']['points'],
$results['fighter_two']['points'],
];
rsort($fight_points);
$score = ' (' . $fight_points[0] . '-' . $fight_points[1] . ')';
if ($results['fighter_one']['points'] > $results['fighter_two']['points']) {
$prediction .= $results['fighter_one']['name'];
$prediction_name = $results['fighter_one']['name'];
}
elseif ($results['fighter_one']['points'] < $results['fighter_two']['points']) {
$prediction .= $results['fighter_two']['name'];
$prediction_name = $results['fighter_two']['name'];
}
else {
$prediction .= 'TIE:';
}
$prediction .= $score;
$entity->set('field_prediction', $prediction);
// If there is a result, compare it to the prediction.
$result = $entity->get('field_result')->getValue();
if (empty($result)) {
return;
}
$result_name = getFighterNameById(reset($result[0]));
/*
* The code below will attempt to update fight
* predictions until they are correct
*
* (EXPERIMENTAL)
*/
if ($result_name !== $prediction_name) {
\Drupal::logger('ufc')->notice($entity->label() . " incorrect. Adjusting.");
// Isolate advantages.
foreach ($results as $fighter) {
if ($fighter['name'] === $result_name) {
$advantages = $fighter['advantages'];
}
if ($fighter['name'] === $prediction_name) {
$disadvantages = $fighter['disadvantages'];
}
}
$predictor->adjustWeights($advantages, $disadvantages);
// updatePrediction($f1, $f2, $entity);
}
// Calculate Confidence.
$skips = $results['skips'];
$confidence_raw = (1 - ($skips / 17)) * 100;
$percentage = round($confidence_raw, 2);
$entity->set('field_accuracy', (float) $percentage);
}
function getFighterNameById($nid) {
$node = \Drupal::entityTypeManager()->getStorage('node')->load($nid);
$name = $node->label();
return $name;
}
function ufc_views_pre_render(ViewExecutable $view) {
foreach ($view->result as $row) {
$html = "<h1>This is some markup</h1>";
$markup = Markup::create($html);
$row->_entity->set('field_plaintext_field', $markup);
}
}

View File

@@ -0,0 +1,7 @@
ufc_predict.form:
path: '/self-heal'
defaults:
_form: '\Drupal\ufc\Form\SelfHealKickoffForm'
_title: 'Self Heal Kickoff'
requirements:
_role: 'authenticated'

View File

@@ -0,0 +1,10 @@
services:
ufc.import:
class: \Drupal\ufc\FighterImporter
arguments: ['@http_client', '@entity_type.manager']
ufc.fighter_create:
class: \Drupal\ufc\Fighter
arguments: ['@http_client','@entity_type.manager']
ufc.predictor:
class: \Drupal\ufc\FightPredictor
arguments: ['@entity_type.manager', '@config.factory']

View File

@@ -4,8 +4,6 @@
# 'example.settings.local.php' file, which sits next to this file.
parameters:
http.response.debug_cacheability_headers: true
twig.config:
debug: true
services:
cache.backend.null:
class: Drupal\Core\Cache\NullBackendFactory

View File

@@ -1,12 +1,102 @@
@import url("https://fonts.googleapis.com/css2?family=Ubuntu:ital,wght@0,300;0,400;0,500;0,700;1,300;1,400;1,500;1,700&display=swap");
.ubuntu-light {
font-family: "Ubuntu", sans-serif;
font-weight: 300;
font-style: normal;
}
.ubuntu-light-italic {
font-family: "Ubuntu", sans-serif;
font-weight: 300;
font-style: italic;
}
.ubuntu-regular {
font-family: "Ubuntu", sans-serif;
font-weight: 400;
font-style: normal;
}
.ubuntu-regular-italic {
font-family: "Ubuntu", sans-serif;
font-weight: 400;
font-style: italic;
}
.ubuntu-medium {
font-family: "Ubuntu", sans-serif;
font-weight: 500;
font-style: normal;
}
.ubuntu-medium-italic {
font-family: "Ubuntu", sans-serif;
font-weight: 500;
font-style: italic;
}
.ubuntu-bold {
font-family: "Ubuntu", sans-serif;
font-weight: 700;
font-style: normal;
}
.ubuntu-bold-italic {
font-family: "Ubuntu", sans-serif;
font-weight: 700;
font-style: italic;
}
body {
background: whitesmoke;
background: #191724;
color: #e0def4;
font-family: "Ubuntu", sans-serif;
}
a {
color: #f6c177;
}
a:visited {
color: #9ccfd8;
}
header {
background: #232323;
color: white;
background: #1f1d2e;
border: 1px solid #eb6f92;
}
header div > * {
display: inline-block;
}
header div#block-dchadwick-site-branding {
padding: 1rem;
}
header div#block-dchadwick-site-branding a {
text-decoration: none;
font-weight: 700;
}
header div#block-dchadwick-site-branding a:visited {
color: #f6c177 !important;
}
.smooth {
transition: all 1s ease-in;
img {
max-width: 100%;
max-height: 100%;
}
header {
background: #1f1d2e;
border: 1px solid #eb6f92;
}
header div > * {
display: inline-block;
}
header div#block-dchadwick-site-branding {
padding: 1rem;
}
header div#block-dchadwick-site-branding a {
text-decoration: none;
font-weight: 700;
}
header div#block-dchadwick-site-branding a:visited {
color: #f6c177 !important;
}

View File

@@ -0,0 +1,18 @@
/**
* @file
*/
var gulp = require('gulp');
const sass = require('gulp-sass')(require('sass'));
var input = './src/sass/*.scss';
var output = './css';
gulp.task('sass', function () {
return gulp
// Find all `.scss` files from the `stylesheets/` folder.
.src(input)
// Run Sass on those files.
.pipe(sass())
// Write the resulting CSS in the output folder.
.pipe(gulp.dest(output));
});

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,20 @@
{
"name": "dchadwick",
"version": "1.0.0",
"description": "",
"main": "gulpfile.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"compile": "gulp sass"
},
"author": "",
"license": "ISC",
"devDependencies": {
"gulp": "^4.0.2",
"gulp-concat": "^2.6.1",
"gulp-sass": "^5.1.0"
},
"dependencies": {
"sass": "^1.71.1"
}
}

Binary file not shown.

View File

@@ -0,0 +1,4 @@
img {
max-width: 100%;
max-height: 100%;
}

View File

@@ -0,0 +1,17 @@
header {
background: $overlay_bl;
border: 1px solid $love;
div > * {
display: inline-block;
}
div#block-dchadwick-site-branding {
padding: 1rem;
a {
text-decoration: none;
font-weight: 700;
&:visited {
color: $gold !important;
}
}
}
}

View File

@@ -0,0 +1,100 @@
// Colors.
$base_bl: #191724;
$overlay_bl: #1f1d2e;
$muted: #6e6a86;
$subtle: #908caa;
$text: #e0def4;
$love: #eb6f92;
$gold: #f6c177;
$rose: #ebbcba;
$pine: #31748f;
$foam: #9ccfd8;
$iris: #c4a7e7;
// Google fonts.
@import url("https://fonts.googleapis.com/css2?family=Ubuntu:ital,wght@0,300;0,400;0,500;0,700;1,300;1,400;1,500;1,700&display=swap");
.ubuntu-light {
font-family: "Ubuntu", sans-serif;
font-weight: 300;
font-style: normal;
}
.ubuntu-light-italic {
font-family: "Ubuntu", sans-serif;
font-weight: 300;
font-style: italic;
}
.ubuntu-regular {
font-family: "Ubuntu", sans-serif;
font-weight: 400;
font-style: normal;
}
.ubuntu-regular-italic {
font-family: "Ubuntu", sans-serif;
font-weight: 400;
font-style: italic;
}
.ubuntu-medium {
font-family: "Ubuntu", sans-serif;
font-weight: 500;
font-style: normal;
}
.ubuntu-medium-italic {
font-family: "Ubuntu", sans-serif;
font-weight: 500;
font-style: italic;
}
.ubuntu-bold {
font-family: "Ubuntu", sans-serif;
font-weight: 700;
font-style: normal;
}
.ubuntu-bold-italic {
font-family: "Ubuntu", sans-serif;
font-weight: 700;
font-style: italic;
}
body {
background: $base_bl;
color: $text;
font-family: "Ubuntu", sans-serif;
}
a {
color: $gold;
&:visited {
color: $foam;
}
}
// Imports.
@import "partials/header";
@import "partials/articles";
header {
background: $overlay_bl;
border: 1px solid $love;
div > * {
display: inline-block;
}
div#block-dchadwick-site-branding {
padding: 1rem;
a {
text-decoration: none;
font-weight: 700;
&:visited {
color: $gold !important;
}
}
}
}

View File

@@ -1,11 +1,5 @@
<header aria-label="Site header" class="header" id="header" role="banner">
{{ page.navigation }}
<div id="color-demo" class="smooth" style="color:red"
hx-get="/colors" hx-swap="outerHTML" hx-trigger="every 1s">
Color Swap Demo
</div>
</header>
<section class="main" id="main">
<main aria-label="Site main content" class="content" id="content" role="main">