Skip to content

Commit a5c111e

Browse files
committed
feat: add stats, fix minor calendar reduce
added intial valuee for `reduce`
1 parent ac26f14 commit a5c111e

2 files changed

Lines changed: 30 additions & 6 deletions

File tree

components/ClassesCalendar.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ export default {
133133
let rand_number = e.name
134134
.split('')
135135
.map((c) => c.codePointAt(0))
136-
.reduce((a, b) => a + b)
136+
.reduce((a, b) => a + b, 0)
137137
let l = this.colors.length
138138
return this.colors[rand_number % l]
139139
},
Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,36 @@
11
<template>
22
<v-row justify="center" align="center">
3-
<v-col cols="12" sm="12" md="10" lg="8">
4-
<v-card class="py-4 d-flex flex-column align-center">
5-
<div>Total Hours : 10</div>
6-
<div>1 2 3 4 5</div>
3+
<v-col cols="12" sm="12" md="12" lg="8">
4+
<v-card>
5+
<v-card-title> Total Credits: {{ totalCredits }}</v-card-title>
6+
<div class="text-center">
7+
<v-chip
8+
class="ma-2"
9+
v-for="clas in selectedClasses"
10+
:key="clas.crn"
11+
close
12+
>
13+
{{ clas.name }}{{ clas.credits }} {{ clas.crn }}
14+
</v-chip>
15+
</div>
716
</v-card>
817
</v-col>
918
</v-row>
1019
</template>
1120

12-
<script lang="ts"></script>
21+
<script>
22+
export default {
23+
data() {
24+
return {}
25+
},
26+
props: {
27+
selectedClasses: { type: Array, default: [] },
28+
},
29+
computed: {
30+
totalCredits() {
31+
console.log(this.selectedClasses)
32+
return this.selectedClasses.reduce((a, b) => a + b.credits, 0)
33+
},
34+
},
35+
}
36+
</script>

0 commit comments

Comments
 (0)