Majority Poll Result Data
Tool class used to create a results object instance for majority judgment polls.
MajorityPollResultData
dataclass
Bases: object
Small class used to store the data related to the results of a majority poll
Source code in apps/votes_results/classes/majority_poll_result_data.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 | |
bad_votes: int = self.option_votes.filter(rating__lt=self.median).count()
class-attribute
instance-attribute
The number of bad votes performed to this option
good_votes: int = self.option_votes.filter(rating__gt=self.median).count()
class-attribute
instance-attribute
The number of good votes performed to this option
median = self.option_votes[math.floor(self.option_votes.count() - 1 / 2)].rating
class-attribute
instance-attribute
The majority grade of the option/poll, called as a median of the value of the votes
option = option
class-attribute
instance-attribute
The poll_option the data is related to
option_votes = MajorityJudgmentModel.objects.filter(poll_option=option.id).order_by('rating')
class-attribute
instance-attribute
All the votes for this option
positive_grade = self.good_votes > self.bad_votes
class-attribute
instance-attribute
The majority grade sign is '+' if good votes are more than bad votes
__gt__(other)
Check if my rating is better than other (so if I am semantically ">" than the other one)
Source code in apps/votes_results/classes/majority_poll_result_data.py
103 104 105 106 107 108 109 110 111 112 113 | |
compare(obj, i=0)
returns 1 if self > obj, -1 if self < obj, 0 if self == obj
Source code in apps/votes_results/classes/majority_poll_result_data.py
160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 | |
get_judjment_percentages()
Get percentage of judjments of each value
Source code in apps/votes_results/classes/majority_poll_result_data.py
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | |
get_qualitative_median()
Get median value as a qualitative judjment
Source code in apps/votes_results/classes/majority_poll_result_data.py
59 60 61 | |
get_sign()
Get sign (as symbol)
Source code in apps/votes_results/classes/majority_poll_result_data.py
67 68 69 | |
majority_values_median(values)
Returns new median from list of majority values
Source code in apps/votes_results/classes/majority_poll_result_data.py
115 116 117 118 119 120 121 122 123 124 125 126 127 | |
median_value(iteration=0)
Calculates the median of the current majority values iteration
Source code in apps/votes_results/classes/majority_poll_result_data.py
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 | |
sorting(obj, i)
Function that gives sorting rules for Majority Poll Result Data Objects
Source code in apps/votes_results/classes/majority_poll_result_data.py
146 147 148 149 150 151 152 153 154 155 156 157 158 | |