Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: color photo conditions fields #1149

Merged
merged 3 commits into from
Feb 13, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions terraso_backend/apps/graphql/schema/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -1117,6 +1117,8 @@ type DepthDependentSoilDataNode {
colorHue: SoilIdDepthDependentSoilDataColorHueChoices
colorValue: SoilIdDepthDependentSoilDataColorValueChoices
colorChroma: SoilIdDepthDependentSoilDataColorChromaChoices
colorPhotoSoilCondition: SoilIdDepthDependentSoilDataColorPhotoSoilConditionChoices
colorPhotoLightingCondition: SoilIdDepthDependentSoilDataColorPhotoLightingConditionChoices
conductivity: Decimal
conductivityTest: SoilIdDepthDependentSoilDataConductivityTestChoices
conductivityUnit: SoilIdDepthDependentSoilDataConductivityUnitChoices
Expand Down Expand Up @@ -1290,6 +1292,24 @@ enum SoilIdDepthDependentSoilDataColorChromaChoices {
CHROMA_8
}

"""An enumeration."""
enum SoilIdDepthDependentSoilDataColorPhotoSoilConditionChoices {
"""Moist"""
MOIST

"""Dry"""
DRY
}

"""An enumeration."""
enum SoilIdDepthDependentSoilDataColorPhotoLightingConditionChoices {
"""Even"""
EVEN

"""Uneven"""
UNEVEN
}

"""The `Decimal` scalar type represents a python Decimal."""
scalar Decimal

Expand Down Expand Up @@ -2258,6 +2278,8 @@ input DepthDependentSoilDataUpdateMutationInput {
colorHue: SoilIdDepthDependentSoilDataColorHueChoices
colorValue: SoilIdDepthDependentSoilDataColorValueChoices
colorChroma: SoilIdDepthDependentSoilDataColorChromaChoices
colorPhotoSoilCondition: SoilIdDepthDependentSoilDataColorPhotoSoilConditionChoices
colorPhotoLightingCondition: SoilIdDepthDependentSoilDataColorPhotoLightingConditionChoices
conductivity: Decimal
conductivityTest: SoilIdDepthDependentSoilDataConductivityTestChoices
conductivityUnit: SoilIdDepthDependentSoilDataConductivityUnitChoices
Expand Down
12 changes: 12 additions & 0 deletions terraso_backend/apps/soil_id/graphql/soil_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,14 @@ def color_value_enum(cls):
def color_chroma_enum(cls):
return cls._meta.fields["color_chroma"].type()

@classmethod
def color_photo_soil_condition_enum(cls):
return cls._meta.fields["color_photo_soil_condition"].type()

@classmethod
def color_photo_lighting_condition_enum(cls):
return cls._meta.fields["color_photo_lighting_condition"].type()

@classmethod
def conductivity_test_enum(cls):
return cls._meta.fields["conductivity_test"].type()
Expand Down Expand Up @@ -393,6 +401,10 @@ class Input:
color_hue = DepthDependentSoilDataNode.color_hue_enum()
color_value = DepthDependentSoilDataNode.color_value_enum()
color_chroma = DepthDependentSoilDataNode.color_chroma_enum()
color_photo_soil_condition = DepthDependentSoilDataNode.color_photo_soil_condition_enum()
color_photo_lighting_condition = (
DepthDependentSoilDataNode.color_photo_lighting_condition_enum()
)
conductivity = graphene.Decimal()
conductivity_test = DepthDependentSoilDataNode.conductivity_test_enum()
conductivity_unit = DepthDependentSoilDataNode.conductivity_unit_enum()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Generated by Django 5.0.1 on 2024-02-08 23:33
paulschreiber marked this conversation as resolved.
Show resolved Hide resolved

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("soil_id", "0009_depthdependentsoildata_clay_percent_and_more"),
]

operations = [
migrations.AddField(
model_name="depthdependentsoildata",
name="color_photo_lighting_condition",
field=models.CharField(
blank=True, choices=[("EVEN", "Even"), ("UNEVEN", "Uneven")], null=True
),
),
migrations.AddField(
model_name="depthdependentsoildata",
name="color_photo_soil_condition",
field=models.CharField(
blank=True, choices=[("MOIST", "Moist"), ("DRY", "Dry")], null=True
),
),
]
12 changes: 12 additions & 0 deletions terraso_backend/apps/soil_id/models/depth_dependent_soil_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,18 @@ class ColorChroma(models.TextChoices):

color_chroma = models.CharField(blank=True, null=True, choices=ColorChroma.choices)

class ColorPhotoSoilCondition(models.TextChoices):
MOIST = "MOIST"
DRY = "DRY"

color_photo_soil_condition = models.CharField(blank=True, null=True, choices = ColorPhotoSoilCondition)

class ColorPhotoLightingCondition(models.TextChoices):
EVEN = "EVEN"
UNEVEN = "UNEVEN"

color_photo_lighting_condition = models.CharField(blank=True, null=True, choices = ColorPhotoLightingCondition)

conductivity = models.DecimalField(
blank=True, null=True, max_digits=100, decimal_places=2, validators=[MinValueValidator(0)]
)
Expand Down
Loading