Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ ENV PYTHONUNBUFFERED=1 \

# ── Runtime dependencies (no build‑deps) ─────────────────────────────────────
RUN RUN_DEPS=" \
postgresql-client \
default-mysql-client \
libxml2 \
cron \
curl \
Expand Down
31 changes: 28 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,38 @@
services:
mysql:
image: mysql:8.0
container_name: ${DB_CONTAINER_NAME:-parts_mysql}
environment:
MYSQL_ROOT_PASSWORD: ${DB_ROOT_PASSWORD:-rootpassword}
MYSQL_DATABASE: ${DB_NAME}
MYSQL_USER: ${DB_USER}
MYSQL_PASSWORD: ${DB_PASSWORD}
volumes:
- mysql_data:/var/lib/mysql
ports:
- "${MYSQL_PORT:-3306}:3306"
restart: always
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "${DB_USER}", "-p${DB_PASSWORD}"]
interval: 10s
timeout: 5s
retries: 5

parts_webapi:
container_name: ${CONTAINER_NAME}
image: bduke97/parts_webapi:${TAG}
depends_on:
mysql:
condition: service_healthy
environment:
DJANGO_MANAGEPY_MIGRATE: "on"
SECRET_KEY: ${SECRET_KEY}
DB_NAME: ${DB_NAME}
DB_USER: ${DB_USER}
DB_PASSWORD: ${DB_PASSWORD}
DB_HOST: ${DB_HOST}
DB_PORT: ${DB_PORT}
DB_ENGINE: ${DB_ENGINE}
DB_HOST: ${DB_HOST:-mysql}
DB_PORT: ${DB_PORT:-3306}
DB_ENGINE: ${DB_ENGINE:-django.db.backends.mysql}
EMAIL_FROM: ${EMAIL_FROM}
EMAIL_HOST: ${EMAIL_HOST}
EMAIL_HOST_USER: ${EMAIL_HOST_USER}
Expand All @@ -35,3 +57,6 @@ services:
restart: always
labels:
com.centurylinklabs.watchtower.enable: false

volumes:
mysql_data:
81 changes: 2 additions & 79 deletions poetry.lock

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

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ optional = true
[tool.poetry.group.uat.dependencies]
gunicorn = "23.0.0"
uwsgi = "2.0.30"
psycopg2-binary = "*"
mysqlclient = "2.2.7"

[build-system]
requires = ["poetry-core"]
Expand Down
18 changes: 18 additions & 0 deletions src/form/migrations/0064_flowquestion_press_to_continue.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 5.2.9 on 2026-02-02 00:52

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('form', '0063_rename_response_id_historicalresponse_id_and_more'),
]

operations = [
migrations.AddField(
model_name='flowquestion',
name='press_to_continue',
field=models.BooleanField(default=False),
),
]
1 change: 1 addition & 0 deletions src/form/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ class FlowQuestion(models.Model):
flow = models.ForeignKey(Flow, models.PROTECT)
question = models.ForeignKey(Question, models.PROTECT)
order = models.IntegerField()
press_to_continue = models.BooleanField(default=False)
active = models.CharField(max_length=1, default="y")
void_ind = models.CharField(max_length=1, default="n")

Expand Down
1 change: 1 addition & 0 deletions src/form/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ class FlowQuestionSerializer(serializers.Serializer):
id = serializers.IntegerField(required=False, allow_null=True)
flow_id = serializers.IntegerField(required=False, allow_null=True)
question = QuestionSerializer()
press_to_continue = serializers.BooleanField()
order = serializers.IntegerField()
active = serializers.CharField()

Expand Down
18 changes: 8 additions & 10 deletions src/form/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def get_questions(
) -> list[dict[str, Any]]:
"""
Get questions filtered by various criteria.

Args:
form_typ: Filter by form type ('field', 'pit', etc.)
active: Filter by active status ('y' or 'n')
Expand All @@ -61,7 +61,7 @@ def get_questions(
is_conditional: If True, only return questions that have conditions
is_not_conditional: If True, only return questions without active conditions
qid: Filter to a specific question ID

Returns:
List of dictionaries containing parsed question data
"""
Expand Down Expand Up @@ -156,10 +156,10 @@ def get_questions(
def parse_question(in_question: Question) -> dict[str, Any]:
"""
Parse a Question object into a comprehensive dictionary with all related data.

Args:
in_question: The Question object to parse

Returns:
Dictionary containing question details, options, conditions, and related data
"""
Expand Down Expand Up @@ -759,6 +759,7 @@ def format_flow_values(flow: Flow):
"id": qf.id,
"flow_id": flow.id,
"question": parse_question(qf.question),
"press_to_continue": qf.press_to_continue,
"order": qf.order,
"active": qf.active,
}
Expand Down Expand Up @@ -964,6 +965,7 @@ def save_flow(data):
else:
question_flow = FlowQuestion.objects.get(id=data_flow_question["id"])

question_flow.press_to_continue = data_flow_question["press_to_continue"]
question_flow.order = data_flow_question["order"]

question_flow.save()
Expand Down Expand Up @@ -1802,9 +1804,7 @@ def graph_responses(graph_id, responses, aggregate_responses=None):
flow_answer.question.question_typ.question_typ
== "mnt-psh-btn"
):
map_entry["points"].append(
loads(flow_answer.value)
)
map_entry["points"].append(loads(flow_answer.value))
else:
raise Exception("not accounted for yet")
value = flow_answer.value
Expand Down Expand Up @@ -2096,9 +2096,7 @@ def aggregate_answers(question_aggregate, response_question_answers):
case "median":
return median([median(values) for values in responses_values])
case "stdev":
return stdev(
[stdev(values) for values in responses_values]
)
return stdev([stdev(values) for values in responses_values])
case "difference":
i = 0
for value_list in responses_values:
Expand Down