Skip to content
This repository has been archived by the owner on Apr 24, 2024. It is now read-only.

Commit

Permalink
Merge branch 'master' into feature/592-implement-heat-map-on-the-fron…
Browse files Browse the repository at this point in the history
…tend
  • Loading branch information
badnames authored Apr 16, 2024
2 parents daaeeaa + 7205bc3 commit 009aebe
Show file tree
Hide file tree
Showing 57 changed files with 838 additions and 203 deletions.
8 changes: 4 additions & 4 deletions .github/ISSUE_TEMPLATE/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@ body:
unfortunately `npm audit --omit=dev fix` does [too much and too little](https://overreacted.io/npm-audit-broken-by-design/),
`cargo deny check` seems to be more helpful
- [ ] check/improve reformatting
- [ ] check if all issues labelled `release critical` are fixed
- [ ] check if all issues labelled [`release critical`](https://issues.permaplant.net/?q=is%3Aopen+is%3Aissue+label%3A%22release+critical%22) are fixed
- [ ] update mergedDatasets.csv
- [ ] Merge PRs (@markus2330)
### Actual Release
- [ ] check if all preps are done
- [ ] manually test dev.permaplant.net according to protocol
- [ ] manually test [dev.permaplant.net](https://dev.permaplant.net/) according to protocol
- [ ] build <https://build.libelektra.org/job/PermaplanT-Release/>
- [ ] git tag -s vX.X.X
- [ ] git push --tags
- [ ] `git tag -s vX.X.X`
- [ ] `git push --tags`
### After Release
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,11 @@ doc-storybook: install-frontend ## Storybook doc
@cd frontend && npm run build-storybook

.PHONY: doc-backend
doc-backend: install-backend ## Backend src doc
@echo "Not implemented yet."
doc-backend: install-types install-backend ## Backend src doc
@cd backend && cargo doc --document-private-items

.PHONY: doc-frontend
doc-frontend: install-frontend ## Frontend src doc
doc-frontend: install-types install-frontend ## Frontend src doc
@cd frontend && npm run doc


Expand Down
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,15 @@ make run-mdbook

Which will open [/doc/architecture/README.md](/doc/architecture/README.md) as first page.

The documentation is also hosted for PR/Development/Release:

| Branch | Backend Documentation (Cargo) | General Documentation (mdBook) | API Documentation (Swagger UI) | Frontend Documentation (Storybook) |
|---------------------|--------------------------------------------------|------------------------------------------------------|----------------------------------------------|--------------------------------------------------|
| Pull Request | [cargodoc](https://doc.permaplant.net/pr/cargodoc/backend) | [mdbook](https://doc.permaplant.net/pr/mdbook/architecture) | [swaggerui](https://pr.permaplant.net/doc/api/swagger/ui/) | [storybook](https://doc.permaplant.net/pr/storybook) |
| Development | [cargodoc](https://doc.permaplant.net/dev/cargodoc/backend) | [mdbook](https://doc.permaplant.net/dev/mdbook/architecture) | [swaggerui](https://dev.permaplant.net/doc/api/swagger/ui/) | [storybook](https://doc.permaplant.net/dev/storybook) |
| Production | [cargodoc](https://doc.permaplant.net/www/cargodoc/backend) | [mdbook](https://doc.permaplant.net/www/mdbook/architecture) | [swaggerui](https://www.permaplant.net/doc/api/swagger/ui) | [storybook](https://doc.permaplant.net/www/storybook) |


## Makefile commands

Type `make help` to see all commands.
Expand Down
46 changes: 34 additions & 12 deletions backend/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion backend/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "backend"
version = "0.3.7"
version = "0.4.0"
description = "The backend of PermaplanT"
repository = "https://github.com/ElektraInitiative/PermaplanT"
license = "BSD-3-Clause"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
DELETE FROM drawings;
DELETE FROM layers WHERE "type" = 'drawing';
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
INSERT INTO layers (map_id, "type", "name", is_alternative)
SELECT
m.id AS map_id,
'drawing' AS layer_type,
'Drawing Layer' AS layer_name,
false AS is_alternative
FROM maps AS m
WHERE NOT EXISTS (SELECT 1 FROM layers AS l WHERE l.map_id = m.id AND l."type" = 'drawing');
2 changes: 2 additions & 0 deletions backend/src/model/dto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ pub struct PlantsSummaryDto {
pub unique_name: String,
/// A list of common english names (E.g. "Bread wheat", "Sour cherry")
pub common_name_en: Option<Vec<Option<String>>>,
/// A list of common german names (E.g. "Brotweizen", "Sauerkirsche")
pub common_name_de: Option<Vec<Option<String>>>,
//TODO: add icon_path: String
/// How far a plant spreads (The 'width' of a plant) in cm
pub spread: Option<i32>,
Expand Down
1 change: 1 addition & 0 deletions backend/src/model/dto/plants_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ impl From<Plants> for PlantsSummaryDto {
id: plants.id,
unique_name: plants.unique_name,
common_name_en: plants.common_name_en,
common_name_de: plants.common_name_de,
spread: plants.spread,
}
}
Expand Down
15 changes: 9 additions & 6 deletions backend/src/model/entity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,15 +162,15 @@ pub struct Plants {
pub soil_texture: Option<Vec<Option<SoilTexture>>>,

/*
/// - *Used* in hydrology layer.
/// - *NOT used* in hydrology layer
/// as it has poor quality and no additional data compared to water_requirement
/// - *Fill ratio:* 37%
/// - *Fetched from* PracticalPlants
/// - wet = drowned, (often) flooded or in general very moist, e.g. swamp
/// - moist = humid, can hold some water, e.g. flat bed with humus
/// - well drained = dry, low capacity to hold water, e.g. sandhill.
/// - *Fill ratio:* 37%
pub soil_water_retention: Option<Vec<Option<SoilWaterRetention>>>,
*/
/*
/// - Only informational.
/// - *Fetched from* PracticalPlants
/// - gives information about environmental conditions, such as drought or wind tolerance
Expand Down Expand Up @@ -260,7 +260,7 @@ pub struct Plants {
/// - *Fill ratio:* 100%
pub updated_at: NaiveDateTime,

/// - *Used* in hydrology layer.
/// - *Used* in watering layer.
/// - Fetched from PracticalPlants and merged with \`has_drought_tolerance\` of Permapeople.
/// - *Fill ratio:* 57%
pub has_drought_tolerance: Option<bool>,
Expand Down Expand Up @@ -320,7 +320,10 @@ pub struct Plants {

/// - *Used* in hydrology layer.
/// - *Fetched from* PracticalPlants and Permapeople (merged with `water` of PracticalPlants).
/// - water = completely aquatic; wet = drowned, (often) flooded or in general very moist, e.g. swamp; moist = humid, regular water supply, e.g. flat bed with humus; well drained = dry, little water input.
/// - water = completely aquatic;
/// - wet = drowned, (often) flooded or in general very moist, e.g. swamp;
/// - moist = humid, regular water supply, e.g. flat bed with humus;
/// - well drained = dry, little water input.
/// - *Fill ratio:* 88%
pub water_requirement: Option<Vec<Option<WaterRequirement>>>,

Expand Down
9 changes: 9 additions & 0 deletions backend/src/test/plant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ async fn test_get_all_plants_succeeds() {
&crate::schema::plants::unique_name.eq("Testia testia"),
&crate::schema::plants::common_name_en
.eq(Some(vec![Some("Testplant".to_string())])),
&crate::schema::plants::common_name_de
.eq(Some(vec![Some("Testpflanze".to_string())])),
&crate::schema::plants::spread.eq(50),
))
.execute(conn)
Expand Down Expand Up @@ -50,6 +52,7 @@ async fn test_get_all_plants_succeeds() {
id: -1,
unique_name: "Testia testia".to_string(),
common_name_en: Some(vec![Some("Testplant".to_string())]),
common_name_de: Some(vec![Some("Testpflanze".to_string())]),
spread: Some(50),
};

Expand All @@ -71,6 +74,8 @@ async fn test_get_one_plant_succeeds() {
&crate::schema::plants::unique_name.eq("Testia testia"),
&crate::schema::plants::common_name_en
.eq(Some(vec![Some("Testplant".to_string())])),
&crate::schema::plants::common_name_de
.eq(Some(vec![Some("Testpflanze".to_string())])),
&crate::schema::plants::spread.eq(50),
))
.execute(conn)
Expand Down Expand Up @@ -99,6 +104,7 @@ async fn test_get_one_plant_succeeds() {
id: -1,
unique_name: "Testia testia".to_string(),
common_name_en: Some(vec![Some("Testplant".to_string())]),
common_name_de: Some(vec![Some("Testpflanze".to_string())]),
spread: Some(50),
};

Expand All @@ -120,6 +126,8 @@ async fn test_search_plants_succeeds() {
&crate::schema::plants::unique_name.eq("Testia testia"),
&crate::schema::plants::common_name_en
.eq(Some(vec![Some("Testplant".to_string())])),
&crate::schema::plants::common_name_de
.eq(Some(vec![Some("Testpflanze".to_string())])),
&crate::schema::plants::spread.eq(50),
))
.execute(conn)
Expand Down Expand Up @@ -148,6 +156,7 @@ async fn test_search_plants_succeeds() {
id: -1,
unique_name: "Testia testia".to_string(),
common_name_en: Some(vec![Some("Testplant".to_string())]),
common_name_de: Some(vec![Some("Testpflanze".to_string())]),
spread: Some(50),
};

Expand Down
2 changes: 2 additions & 0 deletions backend/src/test/util/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ pub struct TestInsertablePlant {
pub id: i32,
pub unique_name: String,
pub common_name_en: Option<Vec<Option<String>>>,
pub common_name_de: Option<Vec<Option<String>>>,
}

impl Default for TestInsertablePlant {
Expand All @@ -101,6 +102,7 @@ impl Default for TestInsertablePlant {
id: -1,
unique_name: "Test Plant 1".to_owned(),
common_name_en: Some(vec![Some("Testplant".to_owned())]),
common_name_de: Some(vec![Some("Testpflanze".to_owned())]),
}
}
}
Expand Down
Loading

0 comments on commit 009aebe

Please sign in to comment.