Skip to content

Commit

Permalink
feat: add clay percent field (#1123)
Browse files Browse the repository at this point in the history
  • Loading branch information
shrouxm authored Jan 24, 2024
1 parent 02ac306 commit c1db042
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 0 deletions.
2 changes: 2 additions & 0 deletions terraso_backend/apps/graphql/schema/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -1111,6 +1111,7 @@ type DepthInterval {

type DepthDependentSoilDataNode {
texture: SoilIdDepthDependentSoilDataTextureChoices
clayPercent: Int
rockFragmentVolume: SoilIdDepthDependentSoilDataRockFragmentVolumeChoices
colorHueSubstep: SoilIdDepthDependentSoilDataColorHueSubstepChoices
colorHue: SoilIdDepthDependentSoilDataColorHueChoices
Expand Down Expand Up @@ -2250,6 +2251,7 @@ input DepthDependentSoilDataUpdateMutationInput {
siteId: ID!
depthInterval: DepthIntervalInput!
texture: SoilIdDepthDependentSoilDataTextureChoices
clayPercent: Int
rockFragmentVolume: SoilIdDepthDependentSoilDataRockFragmentVolumeChoices
colorHueSubstep: SoilIdDepthDependentSoilDataColorHueSubstepChoices
colorHue: SoilIdDepthDependentSoilDataColorHueChoices
Expand Down
1 change: 1 addition & 0 deletions terraso_backend/apps/soil_id/graphql/soil_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,7 @@ class Input:
site_id = graphene.ID(required=True)
depth_interval = graphene.Field(DepthIntervalInput, required=True)
texture = DepthDependentSoilDataNode.texture_enum()
clay_percent = graphene.Int()
rock_fragment_volume = DepthDependentSoilDataNode.rock_fragment_volume_enum()
color_hue_substep = DepthDependentSoilDataNode.color_hue_substep_enum()
color_hue = DepthDependentSoilDataNode.color_hue_enum()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Copyright © 2024 Technology Matters
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see https://www.gnu.org/licenses/.

# Generated by Django 5.0.1 on 2024-01-18 01:02

import django.core.validators
from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("soil_id", "0008_soildata_depth_interval_preset"),
]

operations = [
migrations.AddField(
model_name="depthdependentsoildata",
name="clay_percent",
field=models.IntegerField(
blank=True,
null=True,
validators=[
django.core.validators.MinValueValidator(0),
django.core.validators.MaxValueValidator(100),
],
),
),
migrations.AlterField(
model_name="soildata",
name="depth_interval_preset",
field=models.CharField(
blank=True,
choices=[("LANDPKS", "Landpks"), ("NRCS", "Nrcs"), ("CUSTOM", "Custom")],
null=True,
),
),
]
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ class Texture(models.TextChoices):

texture = models.CharField(blank=True, null=True, choices=Texture.choices)

clay_percent = models.IntegerField(
blank=True, null=True, validators=[MinValueValidator(0), MaxValueValidator(100)]
)

class RockFragmentVolume(models.TextChoices):
VOLUME_0_1 = "VOLUME_0_1", "0 — 1%"
VOLUME_1_15 = "VOLUME_1_15", "1 — 15%"
Expand Down

0 comments on commit c1db042

Please sign in to comment.