mirror of
https://code.lenaisten.de/Lenaisten/advent22.git
synced 2024-11-22 15:53:01 +00:00
rename DayPartModel -> DayStrModel
This commit is contained in:
parent
3ccd3da28a
commit
5694438c96
4 changed files with 17 additions and 30 deletions
|
@ -85,20 +85,21 @@ async def get_config_model(
|
|||
)
|
||||
|
||||
|
||||
class DayPartModel(BaseModel):
|
||||
class DayStrModel(BaseModel):
|
||||
day: int
|
||||
part: str
|
||||
value: str
|
||||
|
||||
|
||||
@router.get("/day_parts")
|
||||
async def get_day_parts(
|
||||
_: None = Depends(require_admin),
|
||||
parts: dict[int, str] = Depends(get_parts),
|
||||
) -> list[DayPartModel]:
|
||||
return [
|
||||
DayPartModel.model_validate({"day": day, "part": part})
|
||||
for day, part in sorted(parts.items())
|
||||
]
|
||||
) -> list[DayStrModel]:
|
||||
"""
|
||||
Zuordnung der Lösungsteile zu den Tagen
|
||||
"""
|
||||
|
||||
return [DayStrModel(day=day, value=part) for day, part in sorted(parts.items())]
|
||||
|
||||
|
||||
@router.get("/doors")
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
:key="`part-${index}`"
|
||||
class="tag is-info"
|
||||
>
|
||||
{{ day_part.day }}: {{ day_part.part.split("").join(", ") }}
|
||||
{{ day_part.day }}: {{ day_part.value.split("").join(", ") }}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
|
@ -50,7 +50,7 @@
|
|||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { DayPartModel } from "@/lib/api";
|
||||
import { DayStrModel } from "@/lib/api";
|
||||
import { Options, Vue } from "vue-class-component";
|
||||
|
||||
import BulmaButton from "./bulma/Button.vue";
|
||||
|
@ -66,7 +66,7 @@ import MultiModal from "./calendar/MultiModal.vue";
|
|||
})
|
||||
export default class extends Vue {
|
||||
public is_loaded = true;
|
||||
public day_parts: DayPartModel[] = [];
|
||||
public day_parts: DayStrModel[] = [];
|
||||
|
||||
declare $refs: {
|
||||
multi_modal: MultiModal;
|
||||
|
@ -75,7 +75,7 @@ export default class extends Vue {
|
|||
public on_open(): void {
|
||||
this.is_loaded = false;
|
||||
|
||||
Promise.all([this.$advent22.api_get<DayPartModel[]>("admin/day_parts")])
|
||||
Promise.all([this.$advent22.api_get<DayStrModel[]>("admin/day_parts")])
|
||||
.then(([day_parts]) => {
|
||||
this.day_parts = day_parts;
|
||||
this.is_loaded = true;
|
||||
|
|
|
@ -18,20 +18,6 @@
|
|||
<dt>Lösung</dt>
|
||||
<dd>{{ config_model.puzzle.solution }}</dd>
|
||||
|
||||
<dt>Reihenfolge</dt>
|
||||
<dd>
|
||||
<template
|
||||
v-for="(day_part, index) in day_parts"
|
||||
:key="`part-${index}`"
|
||||
>
|
||||
<span>
|
||||
<template v-if="index > 0"> – </template>
|
||||
{{ day_part.day }}:
|
||||
</span>
|
||||
<span class="is-family-monospace">{{ day_part.part }}</span>
|
||||
</template>
|
||||
</dd>
|
||||
|
||||
<dt>Offene Türchen</dt>
|
||||
<!-- TODO -->
|
||||
<dd>10</dd>
|
||||
|
@ -137,7 +123,7 @@
|
|||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { ConfigModel, DayPartModel } from "@/lib/api";
|
||||
import { ConfigModel, DayStrModel } from "@/lib/api";
|
||||
import { Options, Vue } from "vue-class-component";
|
||||
|
||||
import BulmaDrawer from "./bulma/Drawer.vue";
|
||||
|
@ -172,14 +158,14 @@ export default class extends Vue {
|
|||
config_file: "config.toml",
|
||||
},
|
||||
};
|
||||
public day_parts: DayPartModel[] = [];
|
||||
public day_parts: DayStrModel[] = [];
|
||||
|
||||
public on_open(): void {
|
||||
this.is_loaded = false;
|
||||
|
||||
Promise.all([
|
||||
this.$advent22.api_get<ConfigModel>("admin/config_model"),
|
||||
this.$advent22.api_get<DayPartModel[]>("admin/day_parts"),
|
||||
this.$advent22.api_get<DayStrModel[]>("admin/day_parts"),
|
||||
])
|
||||
.then(([config_model, day_parts]) => {
|
||||
this.config_model = config_model;
|
||||
|
|
|
@ -22,9 +22,9 @@ export interface ConfigModel {
|
|||
};
|
||||
}
|
||||
|
||||
export interface DayPartModel {
|
||||
export interface DayStrModel {
|
||||
day: number;
|
||||
part: string;
|
||||
value: string;
|
||||
}
|
||||
|
||||
export interface DoorSaved {
|
||||
|
|
Loading…
Reference in a new issue