fixed formatting and minor bug causeing the start of the period to always be the current day.

This commit is contained in:
AquaticLava 2023-05-18 11:14:59 -06:00
parent 693b43af2e
commit 6c9227faac
2 changed files with 48 additions and 43 deletions

View File

@ -18,7 +18,7 @@
<excludeFolder url="file://$MODULE_DIR$/staticfiles" /> <excludeFolder url="file://$MODULE_DIR$/staticfiles" />
<excludeFolder url="file://$MODULE_DIR$/venv" /> <excludeFolder url="file://$MODULE_DIR$/venv" />
</content> </content>
<orderEntry type="inheritedJdk" /> <orderEntry type="jdk" jdkName="Python 3.11 (recipes)" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />
</component> </component>
<component name="TemplatesService"> <component name="TemplatesService">

View File

@ -290,6 +290,9 @@
<button class="btn btn-success shadow-none" @click="createEntryClick(new Date())"><i <button class="btn btn-success shadow-none" @click="createEntryClick(new Date())"><i
class="fas fa-calendar-plus"></i> {{ $t("Create") }} class="fas fa-calendar-plus"></i> {{ $t("Create") }}
</button> </button>
<button class="btn btn-primary shadow-none" @click="createAutoPlan(new Date())"><i
class="fas fa-calendar-plus"></i> {{ $t("Auto_Planner") }}
</button>
<a class="btn btn-primary shadow-none" :href="iCalUrl"><i class="fas fa-download"></i> <a class="btn btn-primary shadow-none" :href="iCalUrl"><i class="fas fa-download"></i>
{{ $t("Export_To_ICal") }} {{ $t("Export_To_ICal") }}
</a> </a>
@ -302,11 +305,7 @@
<a class="dropdown-item" @click="createEntryClick(new Date())"><i <a class="dropdown-item" @click="createEntryClick(new Date())"><i
class="fas fa-calendar-plus fa-fw"></i> {{ $t("Create") }}</a> class="fas fa-calendar-plus fa-fw"></i> {{ $t("Create") }}</a>
</template> </template>
<div class="col-md-3 col-6 mb-1 mb-md-0">
<button class="btn btn-block btn-primary shadow-none" @click="createAutoPlan(new Date())">
{{ $t("Auto_Planner") }}
</button>
</div>
</bottom-navigation-bar> </bottom-navigation-bar>
</div> </div>
</template> </template>
@ -677,7 +676,7 @@ export default {
this.$bvModal.show(`id_meal_plan_edit_modal`) this.$bvModal.show(`id_meal_plan_edit_modal`)
}) })
} },
createAutoPlan() { createAutoPlan() {
this.$bvModal.show(`autoplan-modal`) this.$bvModal.show(`autoplan-modal`)
}, },
@ -688,9 +687,15 @@ export default {
currentEntry.date = moment(date).add(dateOffset, "d").format("YYYY-MM-DD") currentEntry.date = moment(date).add(dateOffset, "d").format("YYYY-MM-DD")
currentEntry.servings = servings currentEntry.servings = servings
await Promise.all([ await Promise.all([
currentEntry.recipe = await this.randomRecipe(keywords[mealTypesKey]).then((result)=>{return result}), currentEntry.recipe = await this.randomRecipe(keywords[mealTypesKey]).then((result) => {
currentEntry.shared = await apiClient.listUserPreferences().then((result) => {return result.data[0].plan_share}), return result
currentEntry.meal_type = await this.getMealType(meal_type[mealTypesKey].id).then((result)=>{return result}) }),
currentEntry.shared = await apiClient.listUserPreferences().then((result) => {
return result.data[0].plan_share
}),
currentEntry.meal_type = await this.getMealType(meal_type[mealTypesKey].id).then((result) => {
return result
})
]) ])
currentEntry.title = currentEntry.recipe.name currentEntry.title = currentEntry.recipe.name
this.createEntry(currentEntry) this.createEntry(currentEntry)
@ -701,7 +706,7 @@ export default {
for (const mealTypesKey in autoPlan.meal_types) { for (const mealTypesKey in autoPlan.meal_types) {
for (let dateOffset = 0; dateOffset < numberOfDays; dateOffset++) { for (let dateOffset = 0; dateOffset < numberOfDays; dateOffset++) {
this.autoPlanThread(autoPlan.date, dateOffset, autoPlan.meal_types, autoPlan.keywords, autoPlan.servings, mealTypesKey) this.autoPlanThread(autoPlan.startDay, dateOffset, autoPlan.meal_types, autoPlan.keywords, autoPlan.servings, mealTypesKey)
} }
} }
}, },