fix: ignore submittable meal status
This commit is contained in:
parent
d214f2f7f6
commit
1b2458bc60
1 changed files with 14 additions and 18 deletions
|
|
@ -66,7 +66,6 @@ export default class MealsController {
|
||||||
public async index({ auth }: HttpContext) {
|
public async index({ auth }: HttpContext) {
|
||||||
const meals = await Meal.query().orderBy('date', 'asc').preload('courses')
|
const meals = await Meal.query().orderBy('date', 'asc').preload('courses')
|
||||||
const data = meals.map(async (meal) => {
|
const data = meals.map(async (meal) => {
|
||||||
if (meal.submittable) {
|
|
||||||
const isRegistered = await MealRegistration.query()
|
const isRegistered = await MealRegistration.query()
|
||||||
.where('meal_id', meal.id)
|
.where('meal_id', meal.id)
|
||||||
.where('user_id', auth.user!.id)
|
.where('user_id', auth.user!.id)
|
||||||
|
|
@ -83,9 +82,6 @@ export default class MealsController {
|
||||||
...meal.serialize(),
|
...meal.serialize(),
|
||||||
isRegistered: !!isRegistered,
|
isRegistered: !!isRegistered,
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
return meal.serialize()
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
return Promise.all(data)
|
return Promise.all(data)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue