diff --git a/software/backend/data/bands-concerts.json b/software/backend/data/bands-concerts.json index d394077..34171da 100644 --- a/software/backend/data/bands-concerts.json +++ b/software/backend/data/bands-concerts.json @@ -251,7 +251,8 @@ "date": "2024-10-30", "price": 79.90, "inStock": 1073, - "location": "LANXESS arena" + "location": "LANXESS arena", + "offered": false }, { "date": "2024-10-23", diff --git a/software/backend/data/exercises.json b/software/backend/data/exercises.json index 5c98b3a..08558c2 100644 --- a/software/backend/data/exercises.json +++ b/software/backend/data/exercises.json @@ -34,8 +34,8 @@ "descriptionEn": "Manipulate the URL and access the help page" }, { - "nameDe": "Das ausgebuchte Konzert buchen", - "nameEn": "Book the unavailable concert", + "nameDe": "Das versteckte Konzert buchen", + "nameEn": "Book the hidden concert", "exerciseNr": 2, "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" diff --git a/software/backend/routes/order.routes.ts b/software/backend/routes/order.routes.ts index b51e05f..d9528dd 100644 --- a/software/backend/routes/order.routes.ts +++ b/software/backend/routes/order.routes.ts @@ -11,6 +11,7 @@ import { Seat } from "../models/locations/seat.model"; import { SeatRow } from "../models/locations/seatRow.model"; import { SeatGroup } from "../models/locations/seatGroup.model"; import { Account } from "../models/user/account.model"; +import { Exercise } from "backend/models/exercises/exercise.model"; export const order = Router() diff --git a/software/backend/scripts/databaseHelper.ts b/software/backend/scripts/databaseHelper.ts index 20bd5f3..1beffdf 100644 --- a/software/backend/scripts/databaseHelper.ts +++ b/software/backend/scripts/databaseHelper.ts @@ -296,13 +296,14 @@ export async function prepopulateDatabase() { } }) .then(async location => { + console.log(concert.offered) concerts.push({ date: concert.date, name: concertGroup.name, price: concert.price, image: "http://localhost:3000/static/" + concertGroup.image, inStock: concert.inStock, - offered: true, + offered: concert.offered != undefined ? concert.offered : true, bandId: dataset.dataValues.id, locationId: location.dataValues.id }) diff --git a/software/src/components/pageParts/concertListItem.vue b/software/src/components/pageParts/concertListItem.vue index 4beb651..40e088d 100644 --- a/software/src/components/pageParts/concertListItem.vue +++ b/software/src/components/pageParts/concertListItem.vue @@ -40,7 +40,7 @@ defineProps({ :title="concert.name" v-if="!loading" :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) : () => {}" > \ No newline at end of file diff --git a/software/src/pages/concerts/concertBookingPage/index.vue b/software/src/pages/concerts/concertBookingPage/index.vue index 8433c4c..ed84dcb 100644 --- a/software/src/pages/concerts/concertBookingPage/index.vue +++ b/software/src/pages/concerts/concertBookingPage/index.vue @@ -15,11 +15,17 @@ const basketStore = useBasketStore() const concertStore = useConcertStore() 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, () => { - concertStore.getConcert(Number(router.currentRoute.value.params.id)) + concertStore.getConcert( + String(router.currentRoute.value.params.locationUrl), + String(router.currentRoute.value.params.date) + ) }) diff --git a/software/src/pages/concerts/concertsPage/concertsListSection.vue b/software/src/pages/concerts/concertsPage/concertsListSection.vue index 1958a5d..7862f82 100644 --- a/software/src/pages/concerts/concertsPage/concertsListSection.vue +++ b/software/src/pages/concerts/concertsPage/concertsListSection.vue @@ -24,26 +24,28 @@ const concertStore = useConcertStore() v-else-if="concertStore.concerts.length > 0" v-for="(concert, index) of concertStore.concerts" > - - - - - +
+ + + + + - - - - - + + + + + +
\ No newline at end of file diff --git a/software/src/pages/locations/locationDetailPage/locationConcertsSection.vue b/software/src/pages/locations/locationDetailPage/locationConcertsSection.vue index ed5018a..857d729 100644 --- a/software/src/pages/locations/locationDetailPage/locationConcertsSection.vue +++ b/software/src/pages/locations/locationDetailPage/locationConcertsSection.vue @@ -23,23 +23,27 @@ const locationStore = useLocationStore() - - - - - - - + + + + + + + + diff --git a/software/src/router/routes.ts b/software/src/router/routes.ts index 9ba53f7..354d8a8 100644 --- a/software/src/router/routes.ts +++ b/software/src/router/routes.ts @@ -41,7 +41,7 @@ const routes = [ // Concerts { path: '/concerts', component: ConcertsPage }, - { path: '/concerts/booking/:id', component: ConcertBookingPage }, + { path: '/concerts/booking/:locationUrl/:date', component: ConcertBookingPage }, // Locations { path: '/locations', component: LocationsPage }, diff --git a/software/src/stores/basket.store.ts b/software/src/stores/basket.store.ts index f0e5098..57795fa 100644 --- a/software/src/stores/basket.store.ts +++ b/software/src/stores/basket.store.ts @@ -114,6 +114,13 @@ export const useBasketStore = defineStore('basketStore', { // Exercise 0.2 is solved exerciseStore.solveExercise(0, 2) + + for (let ticket of this.itemsInBasket) { + if (!ticket.concert.offered) { + exerciseStore.solveExercise(1, 2) + feedbackStore.addSnackbar(BannerStateEnum.EXERCISESOLVED12) + } + } } else { feedbackStore.addSnackbar(BannerStateEnum.ERROR) } diff --git a/software/src/stores/concert.store.ts b/software/src/stores/concert.store.ts index 0c8cdde..c2e2eef 100644 --- a/software/src/stores/concert.store.ts +++ b/software/src/stores/concert.store.ts @@ -60,10 +60,14 @@ export const useConcertStore = defineStore("concertStore", { * * @param id ID of the concert in the database */ - async getConcert(id: number) { + async getConcert(location: string, date: string) { const feedbackStore = useFeedbackStore() this.fetchInProgress = true + let id = this.concerts.find((concert: ConcertApiModel) => { + return (concert.location.urlName == location && concert.date == date) + }).id + fetchConcertById(id) .then(result => { this.concert = result.data