more better well factoredness

This commit is contained in:
Jared Numrab
2021-11-22 04:10:53 -05:00
parent f1a6b53265
commit c2d1ccb2bd
5 changed files with 55 additions and 29 deletions

View File

@ -17,14 +17,14 @@ 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):
def get_attribute(self, ref_attribute):
for attribute in self.attributes:
if attribute.id == id and attribute.value == value:
if attribute.id == ref_attribute.id and attribute.value == ref_attribute.value:
return attribute.value
return False
def attribute_exists(self, id, value):
def attribute_exists(self, ref_attribute):
for attribute in self.attributes:
if attribute.id == id and attribute.value == value:
if attribute.id == ref_attribute.id and attribute.value == ref_attribute.value:
return True
return False

View File

@ -17,3 +17,13 @@ class SolverRun(BaseModel):
theta_cut_score: float = 0.00
advanced_options: Optional[AdvancedOptions]
engine: str
def get_item(self, item_id):
for item in self.items:
if str(item.id) == item_id:
return item
return False
def remove_items(self, items):
self.items = [item for item in self.items if item not in items]
return True