Skip to content

Commit b2d7717

Browse files
Fix validator; squash migrations
1 parent 105960b commit b2d7717

3 files changed

Lines changed: 121 additions & 131 deletions

File tree

backend/problem/migrations/0001_initial.py

Lines changed: 116 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
# Generated by Django 4.2.20 on 2025-05-02 09:23
1+
# Generated by Django 4.2.20 on 2025-05-22 11:08
22

33
import django.core.validators
44
from django.db import migrations, models
5+
import django.db.models.deletion
56

67

78
class Migration(migrations.Migration):
@@ -11,6 +12,81 @@ class Migration(migrations.Migration):
1112
dependencies = []
1213

1314
operations = [
15+
migrations.CreateModel(
16+
name="FracasProblem",
17+
fields=[
18+
(
19+
"id",
20+
models.BigAutoField(
21+
auto_created=True,
22+
primary_key=True,
23+
serialize=False,
24+
verbose_name="ID",
25+
),
26+
),
27+
("fracas_id", models.IntegerField(unique=True)),
28+
(
29+
"question",
30+
models.CharField(
31+
help_text="The question from the original FraCaS problem. 4 problems do not have a question.",
32+
max_length=255,
33+
),
34+
),
35+
(
36+
"hypothesis",
37+
models.CharField(
38+
help_text="The answer formulated as a hypothesis by McCartney.",
39+
max_length=255,
40+
),
41+
),
42+
(
43+
"answer",
44+
models.CharField(
45+
help_text='The answer from the original FraCaS problem. Most are "Yes", "No", or "Don\'t know", but not always.',
46+
max_length=255,
47+
),
48+
),
49+
(
50+
"fracas_answer",
51+
models.CharField(
52+
choices=[
53+
("yes", "Yes"),
54+
("no", "No"),
55+
("unknown", "Unknown"),
56+
("undef", "Undef"),
57+
],
58+
help_text="The answer constrained to one of a fixed set of values by McCartney.",
59+
max_length=20,
60+
),
61+
),
62+
(
63+
"fracas_non_standard",
64+
models.BooleanField(
65+
help_text='Indicates whether the answer in the origianl FraCaS problem is non-standard (i.e. not "Yes", "No", or "Don\'t know")'
66+
),
67+
),
68+
(
69+
"note",
70+
models.TextField(
71+
help_text="Note given by McCartney to explain issues arising during translation to XML."
72+
),
73+
),
74+
(
75+
"section_name",
76+
models.CharField(
77+
help_text="The section name from the original FraCaS problem.",
78+
max_length=255,
79+
),
80+
),
81+
(
82+
"subsection_name",
83+
models.CharField(
84+
help_text="The subsection name from the original FraCaS problem.",
85+
max_length=255,
86+
),
87+
),
88+
],
89+
),
1490
migrations.CreateModel(
1591
name="SickProblem",
1692
fields=[
@@ -44,10 +120,48 @@ class Migration(migrations.Migration):
44120
max_digits=4,
45121
validators=[
46122
django.core.validators.MinValueValidator(1),
47-
django.core.validators.MinValueValidator(5),
123+
django.core.validators.MaxValueValidator(5),
48124
],
49125
),
50126
),
51127
],
52128
),
129+
migrations.CreateModel(
130+
name="FracasPremise",
131+
fields=[
132+
(
133+
"id",
134+
models.BigAutoField(
135+
auto_created=True,
136+
primary_key=True,
137+
serialize=False,
138+
verbose_name="ID",
139+
),
140+
),
141+
(
142+
"premise_index",
143+
models.IntegerField(
144+
help_text="The index of the premise in the original FraCaS problem."
145+
),
146+
),
147+
(
148+
"premise",
149+
models.CharField(
150+
help_text="The premise from the original FraCaS problem.",
151+
max_length=255,
152+
),
153+
),
154+
(
155+
"fracas_problem",
156+
models.ForeignKey(
157+
on_delete=django.db.models.deletion.CASCADE,
158+
related_name="premises",
159+
to="problem.fracasproblem",
160+
),
161+
),
162+
],
163+
options={
164+
"unique_together": {("fracas_problem", "premise_index")},
165+
},
166+
),
53167
]

backend/problem/migrations/0002_fracasproblem_fracaspremise.py

Lines changed: 0 additions & 127 deletions
This file was deleted.

backend/problem/models.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from django.db import models
2-
from django.core.validators import MinValueValidator
2+
from django.core.validators import MinValueValidator, MaxValueValidator
33

44

55
class SickProblem(models.Model):
@@ -23,7 +23,10 @@ class Dataset(models.TextChoices):
2323
relatedness_score = models.DecimalField(
2424
max_digits=4,
2525
decimal_places=3,
26-
validators=[MinValueValidator(1), MinValueValidator(5)],
26+
validators=[
27+
MinValueValidator(1),
28+
MaxValueValidator(5),
29+
],
2730
)
2831

2932

0 commit comments

Comments
 (0)