Compare commits

...

5 Commits

Author SHA1 Message Date
da525d98cb Merge pull request 'staging' (#260) from staging into main
All checks were successful
CI/CD Pipeline / test (push) Successful in 9m45s
CI/CD Pipeline / deploy-staging (push) Has been skipped
CI/CD Pipeline / deploy-main (push) Successful in 4m12s
Reviewed-on: #260
2024-03-09 18:17:15 +01:00
09e11dbb2b show two rowes of boats for the 3 most left 'aisles'
All checks were successful
CI/CD Pipeline / test (push) Successful in 9m55s
CI/CD Pipeline / deploy-staging (push) Successful in 4m5s
CI/CD Pipeline / deploy-main (push) Has been skipped
2024-03-09 18:16:32 +01:00
e94fc79580 deployed :-)
All checks were successful
CI/CD Pipeline / test (push) Successful in 9m53s
CI/CD Pipeline / deploy-staging (push) Successful in 4m5s
CI/CD Pipeline / deploy-main (push) Has been skipped
2024-03-09 17:02:50 +01:00
2445e82c69 Merge pull request 'boatshouse' (#259) from boatshouse into staging
Some checks are pending
CI/CD Pipeline / test (push) Waiting to run
CI/CD Pipeline / deploy-staging (push) Blocked by required conditions
CI/CD Pipeline / deploy-main (push) Blocked by required conditions
Reviewed-on: #259
2024-03-09 16:59:56 +01:00
75be5d3ca2 Merge pull request 'boatshouse' (#257) from boatshouse into staging
All checks were successful
CI/CD Pipeline / test (push) Successful in 10m12s
CI/CD Pipeline / deploy-staging (push) Successful in 4m13s
CI/CD Pipeline / deploy-main (push) Has been skipped
Reviewed-on: #257
2024-03-08 22:23:42 +01:00
3 changed files with 59 additions and 19 deletions

View File

@ -17,22 +17,52 @@ pub struct Boathouse {
}
impl Boathouse {
pub async fn get(db: &SqlitePool) -> HashMap<&str, HashMap<&str, [Option<(i64, Boat)>; 4]>> {
let mut ret: HashMap<&str, HashMap<&str, [Option<(i64, Boat)>; 4]>> = HashMap::new();
pub async fn get(db: &SqlitePool) -> HashMap<&str, HashMap<&str, [Option<(i64, Boat)>; 12]>> {
let mut ret: HashMap<&str, HashMap<&str, [Option<(i64, Boat)>; 12]>> = HashMap::new();
let mut mountain = HashMap::new();
mountain.insert("mountain", [None, None, None, None]);
mountain.insert("water", [None, None, None, None]);
mountain.insert(
"mountain",
[
None, None, None, None, None, None, None, None, None, None, None, None,
],
);
mountain.insert(
"water",
[
None, None, None, None, None, None, None, None, None, None, None, None,
],
);
ret.insert("mountain-aisle", mountain);
let mut middle = HashMap::new();
middle.insert("mountain", [None, None, None, None]);
middle.insert("water", [None, None, None, None]);
middle.insert(
"mountain",
[
None, None, None, None, None, None, None, None, None, None, None, None,
],
);
middle.insert(
"water",
[
None, None, None, None, None, None, None, None, None, None, None, None,
],
);
ret.insert("middle-aisle", middle);
let mut water = HashMap::new();
water.insert("mountain", [None, None, None, None]);
water.insert("water", [None, None, None, None]);
water.insert(
"mountain",
[
None, None, None, None, None, None, None, None, None, None, None, None,
],
);
water.insert(
"water",
[
None, None, None, None, None, None, None, None, None, None, None, None,
],
);
ret.insert("water-aisle", water);
let boathouses = sqlx::query_as!(

View File

@ -1,9 +0,0 @@
CREATE TABLE IF NOT EXISTS "boathouse" (
"id" INTEGER PRIMARY KEY AUTOINCREMENT,
"boat_id" INTEGER NOT NULL REFERENCES boat(id),
"aisle" TEXT NOT NULL CHECK (aisle in ('water', 'middle', 'mountain')),
"side" TEXT NOT NULL CHECK(side IN ('mountain', 'water')),
"level" INTEGER NOT NULL CHECK(level BETWEEN 0 AND 3),
CONSTRAINT unq UNIQUE (aisle, side, level) -- only 1 boat allowed to rest at each space
);

View File

@ -7,7 +7,8 @@
{% set aisle = aisle_name ~ "-aisle" %}
{% set place = boathouse[aisle][side_name] %}
{% if place[level] %}
{{ place[level].1.name }} <a class="btn btn-primary absolute end-0" href="/board/boathouse/{{ place[level].0 }}/delete">X</a>
{{ place[level].1.name }} <a class="btn btn-primary absolute end-0"
href="/board/boathouse/{{ place[level].0 }}/delete">X</a>
{% elif boats | length > 0 %}
<details>
<summary>Kein Boot</summary>
@ -33,11 +34,29 @@
{{ self::show_place(aisle_name = aisle_name, side_name = side_name, level = 1) }}
{{ self::show_place(aisle_name = aisle_name, side_name = side_name, level = 2) }}
{{ self::show_place(aisle_name = aisle_name, side_name = side_name, level = 3) }}
{{ self::show_place(aisle_name = aisle_name, side_name = side_name, level = 4) }}
{{ self::show_place(aisle_name = aisle_name, side_name = side_name, level = 5) }}
{% set show_additional = false %}
{% if aisle_name == "mountain" %}
{% set show_additional = true %}
{% elif aisle_name == "middle" and side_name == "mountain" %}
{% set show_additional = true %}
{% endif %}
{% if show_additional %}
<hr />
{{ self::show_place(aisle_name = aisle_name, side_name = side_name, level = 6) }}
{{ self::show_place(aisle_name = aisle_name, side_name = side_name, level = 7) }}
{{ self::show_place(aisle_name = aisle_name, side_name = side_name, level = 8) }}
{{ self::show_place(aisle_name = aisle_name, side_name = side_name, level = 9) }}
{{ self::show_place(aisle_name = aisle_name, side_name = side_name, level = 10) }}
{{ self::show_place(aisle_name = aisle_name, side_name = side_name, level = 11) }}
{% endif %}
</ol>
</div>
{% endmacro show_side %}
{% macro show_aisle(name, last=false) %}
<div id="{{ name }}-aisle" class="grid grid-cols-2 gap-4 {% if not last %}md:border-r{% endif %}">
<div id="{{ name }}-aisle"
class="grid grid-cols-2 gap-4 {% if not last %}md:border-r{% endif %}">
{{ self::show_side(aisle_name = name, side_name = "mountain") }}
{{ self::show_side(aisle_name = name, side_name = "water") }}
</div>