From 1d9b2c694cb21b834d86cc1e92332d2dd0cdb256 Mon Sep 17 00:00:00 2001 From: Jared Numrab Date: Sun, 21 Nov 2021 21:52:18 -0500 Subject: [PATCH] add remaining constraints --- app/models/constraint.py | 4 ++-- app/models/item.py | 12 ++++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/app/models/constraint.py b/app/models/constraint.py index 84eb1b2..2c84a60 100644 --- a/app/models/constraint.py +++ b/app/models/constraint.py @@ -5,5 +5,5 @@ from models.attribute import Attribute class Constraint(BaseModel): reference_attribute: Attribute - minimum: int - maximum: int + minimum: float + maximum: float diff --git a/app/models/item.py b/app/models/item.py index 86beb61..71bffcf 100644 --- a/app/models/item.py +++ b/app/models/item.py @@ -16,3 +16,15 @@ class Item(BaseModel): def irf(self, solver_run, theta): return ItemResponseFunction(solver_run.irt_model).calculate(b_param=self.b_param,theta=theta) + + def get_attribute(self, id, value): + for attribute in self.attributes: + if attribute.id == id and attribute.value == value: + return attribute.value + return False + + def attribute_exists(self, id, value): + for attribute in self.attributes: + if attribute.id == id and attribute.value == value: + return True + return False \ No newline at end of file