small fix
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="box">
|
<div class="box">
|
||||||
<h2 class="subtitle">Week</h2>
|
|
||||||
<button @click="fetchSolution" class="button is-primary">FetchSolution</button>
|
<button @click="fetchSolution" class="button is-primary">FetchSolution</button>
|
||||||
<hr />
|
<hr />
|
||||||
<div v-if="template">
|
<div v-if="template">
|
||||||
@@ -34,8 +33,8 @@ const groupBy = function(items, keyGetter) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const DAYS = ["Lundi", "Mardi", "Mercredi", "Jeudi", "Vendredi", "Samedi", "Dimanche"];
|
const DAYS = ["Lundi", "Mardi", "Mercredi", "Jeudi", "Vendredi", "Samedi", "Dimanche"];
|
||||||
const compareWeekDay = function(a, b) {
|
const compareWeekDay = function(entryA, entryB) {
|
||||||
return DAYS.indexOf(a[0]) - DAYS.indexOf(b[0]);
|
return DAYS.indexOf(entryA[0]) - DAYS.indexOf(entryB[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
const MEALS = ["Breakfast", "Lunch", "Dinner"];
|
const MEALS = ["Breakfast", "Lunch", "Dinner"];
|
||||||
@@ -60,9 +59,7 @@ export default {
|
|||||||
computed: {
|
computed: {
|
||||||
itemsGroupedByDay: function() {
|
itemsGroupedByDay: function() {
|
||||||
let grouped = groupBy(this.template.items, item => item.key[0]);
|
let grouped = groupBy(this.template.items, item => item.key[0]);
|
||||||
console.log(grouped);
|
|
||||||
let sorted = new Map([...grouped.entries()].sort(compareWeekDay));
|
let sorted = new Map([...grouped.entries()].sort(compareWeekDay));
|
||||||
console.log(sorted);
|
|
||||||
sorted.forEach((meals) => meals.sort(compareMealType));
|
sorted.forEach((meals) => meals.sort(compareMealType));
|
||||||
return sorted;
|
return sorted;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user