Skip to content

Commit

Permalink
Restore script section removed inadvertently.
Browse files Browse the repository at this point in the history
  • Loading branch information
wil93 committed Feb 8, 2024
1 parent 610e009 commit cf6cb50
Showing 1 changed file with 50 additions and 1 deletion.
51 changes: 50 additions & 1 deletion src/components/Task.vue
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,56 @@

<script>
export default {
name: 'Task'
name: 'Task',
data () {
return {
remote: null,
searchQuery: null
}
},
created () {
this.init()
},
watch: {
// call again the method if the route changes
'$route': 'init'
},
// beforeRouteUpdate (to, from, next) {
// this.init()
// next()
// },
methods: {
init: function () {
// fetch JSON data for the round
fetch(new Request('/json/edition.' + this.$route.params.editionId + '.round.' + this.$route.params.roundId + '.' + this.$route.params.taskId + '.json'), { method: 'GET' }).then((data) => {
data.json().then((data) => {
this.remote = data
// outside of "app" scope, so it needs to be done manually
document.title = this.remote.title + ' (' + this.remote.edition + ', ' + this.remote.round + ') ­— OIS'
})
})
},
filterQuery: function (ranking) {
if (this.searchQuery == null) {
return ranking
}
let query = this.searchQuery.toLowerCase()
return ranking.filter(function (row) {
return row.team.name.toLowerCase().indexOf(query) >= 0 ||
row.team.fullregion.toLowerCase().indexOf(query) >= 0 ||
row.team.institute.toLowerCase().indexOf(query) >= 0
})
}
}
}
</script>

Expand Down

0 comments on commit cf6cb50

Please sign in to comment.