-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathquestion.py
31 lines (27 loc) · 1.17 KB
/
question.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# Represents an individual question.
class Question:
def __init__(self, test, percentage_correct = 0, discard = False, text = '', discrimination = None, weight = None):
# {!Test} The test containing this question.
self.test = test
# {string} The question text string.
self.text = text
# {number} The percentage of students that answered this question correctly.
self.percentage_correct = percentage_correct
# {boolean} If this question should be discarded from analysis.
self.discard = (percentage_correct == 100) or (percentage_correct == 0) or discard
# {number} The question weight, or item score.
self.item_weight = weight
# {number} The discrimination of the question.
self.discrimination = discrimination
# Retrieve the discrimination for a specific question.
def get_discrimination(self):
# Calculate and cache the discrimination row.
if self.discrimination is None:
self.test.calculate_question_stats()
return self.discrimination
# Retrieve the item weight for a specific question.
def get_item_weight(self):
# Calculate and cache the discrimination row.
if self.item_weight is None:
self.test.calculate_question_stats()
return self.item_weight