diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2eea525 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.env \ No newline at end of file diff --git a/backend/right_tree/api/data/fixtures/eco_regions.json b/backend/right_tree/api/data/fixtures/001_eco_regions.json similarity index 100% rename from backend/right_tree/api/data/fixtures/eco_regions.json rename to backend/right_tree/api/data/fixtures/001_eco_regions.json diff --git a/backend/right_tree/api/data/fixtures/tolerance_levels.json b/backend/right_tree/api/data/fixtures/002_tolerance_levels.json similarity index 100% rename from backend/right_tree/api/data/fixtures/tolerance_levels.json rename to backend/right_tree/api/data/fixtures/002_tolerance_levels.json diff --git a/backend/right_tree/api/data/fixtures/soil_variants.json b/backend/right_tree/api/data/fixtures/003_soil_variants.json similarity index 100% rename from backend/right_tree/api/data/fixtures/soil_variants.json rename to backend/right_tree/api/data/fixtures/003_soil_variants.json diff --git a/backend/right_tree/api/data/fixtures/soil_order_mappings.json b/backend/right_tree/api/data/fixtures/004_soil_order_mappings.json similarity index 100% rename from backend/right_tree/api/data/fixtures/soil_order_mappings.json rename to backend/right_tree/api/data/fixtures/004_soil_order_mappings.json diff --git a/backend/right_tree/api/data/fixtures/habitats.json b/backend/right_tree/api/data/fixtures/005_habitats.json similarity index 100% rename from backend/right_tree/api/data/fixtures/habitats.json rename to backend/right_tree/api/data/fixtures/005_habitats.json diff --git a/backend/right_tree/api/data/fixtures/zones.json b/backend/right_tree/api/data/fixtures/006_zones.json similarity index 99% rename from backend/right_tree/api/data/fixtures/zones.json rename to backend/right_tree/api/data/fixtures/006_zones.json index de77cc0..5d3c90d 100644 --- a/backend/right_tree/api/data/fixtures/zones.json +++ b/backend/right_tree/api/data/fixtures/006_zones.json @@ -747,7 +747,7 @@ "model": "api.zone", "pk": 63, "fields": { - "name": "HERBACEOUS", + "name": "HERBACEOUS ", "variant": "Border", "refined_variant": null, "redirect_habitat": null, diff --git a/backend/right_tree/api/data/fixtures/007_sample_habitat_images.json b/backend/right_tree/api/data/fixtures/007_sample_habitat_images.json new file mode 100644 index 0000000..511d5f3 --- /dev/null +++ b/backend/right_tree/api/data/fixtures/007_sample_habitat_images.json @@ -0,0 +1,20 @@ +[ + { + "model": "api.habitatimage", + "pk": 1, + "fields": { + "habitat": 7, + "name": "Mangrove", + "image_filename": "01-coastal-mangroves-marshes.png" + } + }, + { + "model": "api.habitatimage", + "pk": 2, + "fields": { + "habitat": 7, + "name": "Salt Marsh", + "image_filename": "03-coastal-grass-reeds-scrub.png" + } + } +] \ No newline at end of file diff --git a/backend/right_tree/api/data/fixtures/008_sample_zone_segments.json b/backend/right_tree/api/data/fixtures/008_sample_zone_segments.json new file mode 100644 index 0000000..de71f25 --- /dev/null +++ b/backend/right_tree/api/data/fixtures/008_sample_zone_segments.json @@ -0,0 +1,52 @@ +[ + { + "model": "api.zoneimagesegment", + "pk": 1, + "fields": { + "zone": 58, + "habitat_image": 1, + "segment_order": 0, + "segment_percentage_width": 7.4 + } + }, + { + "model": "api.zoneimagesegment", + "pk": 2, + "fields": { + "zone": 126, + "habitat_image": 1, + "segment_order": 1, + "segment_percentage_width": 8.7 + } + }, + { + "model": "api.zoneimagesegment", + "pk": 3, + "fields": { + "zone": 98, + "habitat_image": 1, + "segment_order": 2, + "segment_percentage_width": 20.6 + } + }, + { + "model": "api.zoneimagesegment", + "pk": 4, + "fields": { + "zone": 77, + "habitat_image": 1, + "segment_order": 4, + "segment_percentage_width": 33.1 + } + }, + { + "model": "api.zoneimagesegment", + "pk": 5, + "fields": { + "zone": 66, + "habitat_image": 1, + "segment_order": 5, + "segment_percentage_width": 30.2 + } + } +] \ No newline at end of file diff --git a/backend/right_tree/api/migrations/0007_alter_zoneimagesegment_segment_percentage_width.py b/backend/right_tree/api/migrations/0007_alter_zoneimagesegment_segment_percentage_width.py new file mode 100644 index 0000000..9058ad0 --- /dev/null +++ b/backend/right_tree/api/migrations/0007_alter_zoneimagesegment_segment_percentage_width.py @@ -0,0 +1,18 @@ +# Generated by Django 3.2.8 on 2021-11-10 02:04 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('api', '0006_auto_20211109_2255'), + ] + + operations = [ + migrations.AlterField( + model_name='zoneimagesegment', + name='segment_percentage_width', + field=models.FloatField(default=0), + ), + ] diff --git a/backend/right_tree/api/models.py b/backend/right_tree/api/models.py index 555578c..c7e19ad 100644 --- a/backend/right_tree/api/models.py +++ b/backend/right_tree/api/models.py @@ -94,10 +94,10 @@ class ZoneImageSegment(models.Model): habitat_image = models.ForeignKey( HabitatImage, on_delete=models.CASCADE, related_name='image_segments') segment_order = models.PositiveIntegerField(default=0) - segment_percentage_width = models.PositiveIntegerField(default=0) + segment_percentage_width = models.FloatField(default=0) def __str__(self): - return f"{self.habitat_image.name}, {self.zone.name}" + return f"{self.habitat_image.name}, {self.zone}" class Meta: ordering = ['segment_order', 'id'] diff --git a/frontend/src/assets/img/habitats/01-coastal-mangroves-marshes.png b/frontend/src/assets/img/habitats/01-coastal-mangroves-marshes.png new file mode 100755 index 0000000..faa8021 Binary files /dev/null and b/frontend/src/assets/img/habitats/01-coastal-mangroves-marshes.png differ diff --git a/frontend/src/assets/img/habitats/03-coastal-grass-reeds-scrub.png b/frontend/src/assets/img/habitats/03-coastal-grass-reeds-scrub.png new file mode 100755 index 0000000..7ff2721 Binary files /dev/null and b/frontend/src/assets/img/habitats/03-coastal-grass-reeds-scrub.png differ diff --git a/frontend/src/components/steps/zone/ZoneSelector.js b/frontend/src/components/steps/zone/ZoneSelector.js index 2510cfc..01ccfe9 100644 --- a/frontend/src/components/steps/zone/ZoneSelector.js +++ b/frontend/src/components/steps/zone/ZoneSelector.js @@ -20,6 +20,8 @@ export default function ZoneSelector(props) { setHabitatImageFile(imageSrc) findAndSetImageHeightFunc(imageSrc) } + }).catch(e => { + findAndSetImageHeightFunc(habitatImageFile) }) }