Working on exercise 1.2
This commit is contained in:
@@ -251,7 +251,8 @@
|
|||||||
"date": "2024-10-30",
|
"date": "2024-10-30",
|
||||||
"price": 79.90,
|
"price": 79.90,
|
||||||
"inStock": 1073,
|
"inStock": 1073,
|
||||||
"location": "LANXESS arena"
|
"location": "LANXESS arena",
|
||||||
|
"offered": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"date": "2024-10-23",
|
"date": "2024-10-23",
|
||||||
|
|||||||
@@ -34,8 +34,8 @@
|
|||||||
"descriptionEn": "Manipulate the URL and access the help page"
|
"descriptionEn": "Manipulate the URL and access the help page"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"nameDe": "Das ausgebuchte Konzert buchen",
|
"nameDe": "Das versteckte Konzert buchen",
|
||||||
"nameEn": "Book the unavailable concert",
|
"nameEn": "Book the hidden concert",
|
||||||
"exerciseNr": 2,
|
"exerciseNr": 2,
|
||||||
"descriptionDe": "Manipuliere die URL so, dass du das ausgebuchte Konzert aufrufen kannst und buche ein Ticket dafür",
|
"descriptionDe": "Manipuliere die URL so, dass du das ausgebuchte Konzert aufrufen kannst und buche ein Ticket dafür",
|
||||||
"descriptionEn": "Manipulate the URL and access the sold out concert and buy a ticket"
|
"descriptionEn": "Manipulate the URL and access the sold out concert and buy a ticket"
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import { Seat } from "../models/locations/seat.model";
|
|||||||
import { SeatRow } from "../models/locations/seatRow.model";
|
import { SeatRow } from "../models/locations/seatRow.model";
|
||||||
import { SeatGroup } from "../models/locations/seatGroup.model";
|
import { SeatGroup } from "../models/locations/seatGroup.model";
|
||||||
import { Account } from "../models/user/account.model";
|
import { Account } from "../models/user/account.model";
|
||||||
|
import { Exercise } from "backend/models/exercises/exercise.model";
|
||||||
|
|
||||||
export const order = Router()
|
export const order = Router()
|
||||||
|
|
||||||
|
|||||||
@@ -296,13 +296,14 @@ export async function prepopulateDatabase() {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
.then(async location => {
|
.then(async location => {
|
||||||
|
console.log(concert.offered)
|
||||||
concerts.push({
|
concerts.push({
|
||||||
date: concert.date,
|
date: concert.date,
|
||||||
name: concertGroup.name,
|
name: concertGroup.name,
|
||||||
price: concert.price,
|
price: concert.price,
|
||||||
image: "http://localhost:3000/static/" + concertGroup.image,
|
image: "http://localhost:3000/static/" + concertGroup.image,
|
||||||
inStock: concert.inStock,
|
inStock: concert.inStock,
|
||||||
offered: true,
|
offered: concert.offered != undefined ? concert.offered : true,
|
||||||
bandId: dataset.dataValues.id,
|
bandId: dataset.dataValues.id,
|
||||||
locationId: location.dataValues.id
|
locationId: location.dataValues.id
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ defineProps({
|
|||||||
:title="concert.name"
|
:title="concert.name"
|
||||||
v-if="!loading"
|
v-if="!loading"
|
||||||
:link="showButton && concert.inStock > 0"
|
:link="showButton && concert.inStock > 0"
|
||||||
@click="showButton && concert.inStock > 0 ? router.push('/concerts/booking/' + concert.id) : () => {}"
|
@click="showButton && concert.inStock > 0 ? router.push('/concerts/booking/' + location.urlName + '/' + concert.date) : () => {}"
|
||||||
>
|
>
|
||||||
<template #prepend>
|
<template #prepend>
|
||||||
<div>
|
<div>
|
||||||
|
|||||||
@@ -5,5 +5,4 @@ import { ConcertModel } from "./concertModel";
|
|||||||
export class ConcertDetailsApiModel extends ConcertModel {
|
export class ConcertDetailsApiModel extends ConcertModel {
|
||||||
location: LocationDetailsApiModel = new LocationDetailsApiModel()
|
location: LocationDetailsApiModel = new LocationDetailsApiModel()
|
||||||
band: BandModel = new BandModel()
|
band: BandModel = new BandModel()
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -6,4 +6,5 @@ export class LocationModel {
|
|||||||
imageOutdoor: string = ""
|
imageOutdoor: string = ""
|
||||||
capacity: number = 0
|
capacity: number = 0
|
||||||
layout: number = 1
|
layout: number = 1
|
||||||
|
urlName: string = ""
|
||||||
}
|
}
|
||||||
@@ -32,6 +32,7 @@ async function startLogin() {
|
|||||||
v-model="accountStore.loginData.username"
|
v-model="accountStore.loginData.username"
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
clearable
|
clearable
|
||||||
|
@keyup.enter="startLogin"
|
||||||
/>
|
/>
|
||||||
</v-col>
|
</v-col>
|
||||||
</v-row>
|
</v-row>
|
||||||
@@ -45,6 +46,7 @@ async function startLogin() {
|
|||||||
variant="outlined"
|
variant="outlined"
|
||||||
v-model="accountStore.loginData.password"
|
v-model="accountStore.loginData.password"
|
||||||
clearable
|
clearable
|
||||||
|
@keyup.enter="startLogin"
|
||||||
/>
|
/>
|
||||||
</v-col>
|
</v-col>
|
||||||
</v-row>
|
</v-row>
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ import { useConcertStore } from '@/stores/concert.store';
|
|||||||
import { useBandStore } from '@/stores/band.store';
|
import { useBandStore } from '@/stores/band.store';
|
||||||
import { useAccountStore } from '@/stores/account.store';
|
import { useAccountStore } from '@/stores/account.store';
|
||||||
import { useLocationStore } from '@/stores/location.store';
|
import { useLocationStore } from '@/stores/location.store';
|
||||||
import { useExerciseStore } from '@/stores/exercise.store';
|
|
||||||
import { useGenreStore } from '@/stores/genre.store';
|
import { useGenreStore } from '@/stores/genre.store';
|
||||||
import { usePreferencesStore } from '@/stores/preferences.store';
|
import { usePreferencesStore } from '@/stores/preferences.store';
|
||||||
import dashboardCard from './dashboardCard.vue';
|
import dashboardCard from './dashboardCard.vue';
|
||||||
@@ -15,13 +14,10 @@ const bandStore = useBandStore()
|
|||||||
const accountStore = useAccountStore()
|
const accountStore = useAccountStore()
|
||||||
const genreStore = useGenreStore()
|
const genreStore = useGenreStore()
|
||||||
const locationStore = useLocationStore()
|
const locationStore = useLocationStore()
|
||||||
const exerciseStore = useExerciseStore()
|
|
||||||
const preferencesStore = usePreferencesStore()
|
const preferencesStore = usePreferencesStore()
|
||||||
const orderStore = useOrderStore()
|
const orderStore = useOrderStore()
|
||||||
const filesStore = useFilesStore()
|
const filesStore = useFilesStore()
|
||||||
|
|
||||||
exerciseStore.solveExercise(2, 1)
|
|
||||||
|
|
||||||
filesStore.getStaticFolders()
|
filesStore.getStaticFolders()
|
||||||
bandStore.getBands()
|
bandStore.getBands()
|
||||||
locationStore.getLocations()
|
locationStore.getLocations()
|
||||||
|
|||||||
@@ -20,7 +20,8 @@ const bandStore = useBandStore()
|
|||||||
</v-col>
|
</v-col>
|
||||||
</v-row>
|
</v-row>
|
||||||
|
|
||||||
<v-row v-for="concert of bandStore.band.concerts">
|
<div v-for="concert of bandStore.band.concerts">
|
||||||
|
<v-row v-if="concert.offered">
|
||||||
<v-col>
|
<v-col>
|
||||||
<concert-list-item
|
<concert-list-item
|
||||||
:concert="concert"
|
:concert="concert"
|
||||||
@@ -31,4 +32,5 @@ const bandStore = useBandStore()
|
|||||||
/>
|
/>
|
||||||
</v-col>
|
</v-col>
|
||||||
</v-row>
|
</v-row>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -15,11 +15,17 @@ const basketStore = useBasketStore()
|
|||||||
const concertStore = useConcertStore()
|
const concertStore = useConcertStore()
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
concertStore.getConcert(Number(router.currentRoute.value.params.id))
|
concertStore.getConcert(
|
||||||
|
String(router.currentRoute.value.params.locationUrl),
|
||||||
|
String(router.currentRoute.value.params.date)
|
||||||
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
watch(() => router.currentRoute.value.params.id, () => {
|
watch(() => router.currentRoute.value.params.id, () => {
|
||||||
concertStore.getConcert(Number(router.currentRoute.value.params.id))
|
concertStore.getConcert(
|
||||||
|
String(router.currentRoute.value.params.locationUrl),
|
||||||
|
String(router.currentRoute.value.params.date)
|
||||||
|
)
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ const concertStore = useConcertStore()
|
|||||||
v-else-if="concertStore.concerts.length > 0"
|
v-else-if="concertStore.concerts.length > 0"
|
||||||
v-for="(concert, index) of concertStore.concerts"
|
v-for="(concert, index) of concertStore.concerts"
|
||||||
>
|
>
|
||||||
|
<div v-if="concert.offered">
|
||||||
<v-row
|
<v-row
|
||||||
v-if="index == 0 ||
|
v-if="index == 0 ||
|
||||||
new Date(concertStore.concerts[index - 1].date).getMonth() !=
|
new Date(concertStore.concerts[index - 1].date).getMonth() !=
|
||||||
@@ -46,4 +47,5 @@ const concertStore = useConcertStore()
|
|||||||
</v-col>
|
</v-col>
|
||||||
</v-row>
|
</v-row>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -23,9 +23,12 @@ const locationStore = useLocationStore()
|
|||||||
</v-row>
|
</v-row>
|
||||||
|
|
||||||
<!-- Show concerts after fetching -->
|
<!-- Show concerts after fetching -->
|
||||||
<v-row
|
<div
|
||||||
v-else-if="locationStore.location.concerts.length > 0"
|
v-else-if="locationStore.location.concerts.length > 0"
|
||||||
v-for="concert of locationStore.location.concerts"
|
v-for="concert of locationStore.location.concerts"
|
||||||
|
>
|
||||||
|
<v-row
|
||||||
|
v-if="concert.offered"
|
||||||
>
|
>
|
||||||
<v-col>
|
<v-col>
|
||||||
<concert-list-item
|
<concert-list-item
|
||||||
@@ -40,6 +43,7 @@ const locationStore = useLocationStore()
|
|||||||
</concert-list-item>
|
</concert-list-item>
|
||||||
</v-col>
|
</v-col>
|
||||||
</v-row>
|
</v-row>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- Show empty state if no items there -->
|
<!-- Show empty state if no items there -->
|
||||||
<v-row v-else>
|
<v-row v-else>
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ const routes = [
|
|||||||
|
|
||||||
// Concerts
|
// Concerts
|
||||||
{ path: '/concerts', component: ConcertsPage },
|
{ path: '/concerts', component: ConcertsPage },
|
||||||
{ path: '/concerts/booking/:id', component: ConcertBookingPage },
|
{ path: '/concerts/booking/:locationUrl/:date', component: ConcertBookingPage },
|
||||||
|
|
||||||
// Locations
|
// Locations
|
||||||
{ path: '/locations', component: LocationsPage },
|
{ path: '/locations', component: LocationsPage },
|
||||||
|
|||||||
@@ -114,6 +114,13 @@ export const useBasketStore = defineStore('basketStore', {
|
|||||||
|
|
||||||
// Exercise 0.2 is solved
|
// Exercise 0.2 is solved
|
||||||
exerciseStore.solveExercise(0, 2)
|
exerciseStore.solveExercise(0, 2)
|
||||||
|
|
||||||
|
for (let ticket of this.itemsInBasket) {
|
||||||
|
if (!ticket.concert.offered) {
|
||||||
|
exerciseStore.solveExercise(1, 2)
|
||||||
|
feedbackStore.addSnackbar(BannerStateEnum.EXERCISESOLVED12)
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
feedbackStore.addSnackbar(BannerStateEnum.ERROR)
|
feedbackStore.addSnackbar(BannerStateEnum.ERROR)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,10 +60,14 @@ export const useConcertStore = defineStore("concertStore", {
|
|||||||
*
|
*
|
||||||
* @param id ID of the concert in the database
|
* @param id ID of the concert in the database
|
||||||
*/
|
*/
|
||||||
async getConcert(id: number) {
|
async getConcert(location: string, date: string) {
|
||||||
const feedbackStore = useFeedbackStore()
|
const feedbackStore = useFeedbackStore()
|
||||||
this.fetchInProgress = true
|
this.fetchInProgress = true
|
||||||
|
|
||||||
|
let id = this.concerts.find((concert: ConcertApiModel) => {
|
||||||
|
return (concert.location.urlName == location && concert.date == date)
|
||||||
|
}).id
|
||||||
|
|
||||||
fetchConcertById(id)
|
fetchConcertById(id)
|
||||||
.then(result => {
|
.then(result => {
|
||||||
this.concert = result.data
|
this.concert = result.data
|
||||||
|
|||||||
Reference in New Issue
Block a user