prefiltering of items

This commit is contained in:
Adrian Manteza
2022-03-23 16:32:33 +00:00
parent 09d3fce02d
commit ad3019e478
3 changed files with 9 additions and 10 deletions

View File

@ -19,12 +19,12 @@ 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, ref_attribute):
def get_attribute(self, ref_attribute: Attribute) -> Attribute or None:
for attribute in self.attributes:
if attribute.id == ref_attribute.id and attribute.value.lower(
) == ref_attribute.value.lower():
return attribute.value
return False
if self.attribute_exists(ref_attribute):
return attribute
return None
def attribute_exists(self, ref_attribute: Attribute) -> bool:
for attribute in self.attributes: