Skip to content

Commit

Permalink
Add stats to stats page
Browse files Browse the repository at this point in the history
  • Loading branch information
phildarnowsky committed Nov 21, 2019
1 parent 81199dc commit d1d9366
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions p3/src/pages/StatsPage.vue
Original file line number Diff line number Diff line change
@@ -1,10 +1,37 @@
<script>
export default {
name: 'StatsPage',
props: {
decks: Object
},
methods: {
nCompleted: function(deck) {
const json = window.localStorage.getItem(deck.id)
if(json) {
return JSON.parse(json).length
} else {
return 0
}
},
nTotal: function(deck) {
return deck.cards.length
}
}
}
</script>

<template>
<div>
<h1>Stats</h1>

<p v-for="deck in decks" :key="deck.id">
{{deck.name}}: {{nCompleted(deck)}}/{{nTotal(deck)}}
</p>

<router-link :to="{name: 'home'}">
Return to main page
</router-link>
Expand Down

0 comments on commit d1d9366

Please sign in to comment.