Add script for importing match schedule and logging
Some checks failed
Code Analysis and Production Deploy / analyze (push) Has been skipped
Code Analysis and Production Deploy / deploy-production (push) Has been skipped
Code Analysis and Production Deploy / deploy-test (push) Successful in 2m2s
Code Analysis and Production Deploy / analyze (pull_request) Failing after 33s
Code Analysis and Production Deploy / deploy-production (pull_request) Has been skipped
Code Analysis and Production Deploy / deploy-test (pull_request) Has been skipped
Require Package Version Change / check (pull_request) Failing after 10s
Some checks failed
Code Analysis and Production Deploy / analyze (push) Has been skipped
Code Analysis and Production Deploy / deploy-production (push) Has been skipped
Code Analysis and Production Deploy / deploy-test (push) Successful in 2m2s
Code Analysis and Production Deploy / analyze (pull_request) Failing after 33s
Code Analysis and Production Deploy / deploy-production (pull_request) Has been skipped
Code Analysis and Production Deploy / deploy-test (pull_request) Has been skipped
Require Package Version Change / check (pull_request) Failing after 10s
- Created `import-spielplan.js` to fetch and parse the match schedule from the specified URL, saving the output as JSON. - Added `run-spielplan-import.sh` to automate the execution of the import script and log output. - Introduced `spielplan.html` file to store the downloaded HTML content for further processing.
This commit is contained in:
@@ -13,6 +13,31 @@
|
||||
</p>
|
||||
</div>
|
||||
<div class="flex items-center space-x-4">
|
||||
<div
|
||||
v-if="seasons.length"
|
||||
class="flex items-center space-x-2"
|
||||
>
|
||||
<label
|
||||
for="season-select"
|
||||
class="text-sm font-medium text-gray-700"
|
||||
>
|
||||
Saison:
|
||||
</label>
|
||||
<select
|
||||
id="season-select"
|
||||
v-model="selectedSeason"
|
||||
class="px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary-500 focus:border-primary-500 bg-white text-sm"
|
||||
@change="loadData"
|
||||
>
|
||||
<option
|
||||
v-for="season in seasons"
|
||||
:key="season.slug"
|
||||
:value="season.slug"
|
||||
>
|
||||
{{ season.label }}
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
<button
|
||||
:disabled="isLoading"
|
||||
class="px-4 py-2 bg-primary-600 text-white rounded-lg hover:bg-primary-700 transition-colors disabled:bg-gray-400"
|
||||
@@ -217,18 +242,34 @@ const headers = ref([])
|
||||
const isLoading = ref(false)
|
||||
const error = ref(null)
|
||||
const lastUpdated = ref('')
|
||||
const seasons = ref([])
|
||||
const selectedSeason = ref('')
|
||||
|
||||
const loadSeasons = async () => {
|
||||
const response = await fetch('/api/spielplan/seasons')
|
||||
const result = await response.json()
|
||||
|
||||
if (result.success) {
|
||||
seasons.value = result.seasons || []
|
||||
selectedSeason.value = result.defaultSeason || seasons.value[0]?.slug || ''
|
||||
}
|
||||
}
|
||||
|
||||
const loadData = async () => {
|
||||
isLoading.value = true
|
||||
error.value = null
|
||||
|
||||
try {
|
||||
const response = await fetch('/api/spielplan')
|
||||
const params = new URLSearchParams()
|
||||
if (selectedSeason.value) params.set('season', selectedSeason.value)
|
||||
const response = await fetch(`/api/spielplan${params.toString() ? `?${params.toString()}` : ''}`)
|
||||
const result = await response.json()
|
||||
|
||||
if (result.success) {
|
||||
spielplanData.value = result.data
|
||||
headers.value = result.headers
|
||||
seasons.value = result.seasons?.length ? result.seasons : seasons.value
|
||||
selectedSeason.value = result.season || selectedSeason.value
|
||||
lastUpdated.value = new Date().toLocaleString('de-DE')
|
||||
} else {
|
||||
error.value = result.message
|
||||
@@ -291,7 +332,8 @@ const formatTime = (timeString) => {
|
||||
return timeString
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
loadData()
|
||||
onMounted(async () => {
|
||||
await loadSeasons()
|
||||
await loadData()
|
||||
})
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user