small fix

This commit is contained in:
2019-02-10 21:42:37 +01:00
parent ccb178ae5a
commit 45029b87d2

View File

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