@@ -75,10 +75,10 @@ public function getVotesAll($userId)
75
75
);
76
76
foreach ($ teams as $ team ) {
77
77
$ stats [$ team ->id ]['team_name ' ] = $ team ->team_name ;
78
- $ stats [$ team ->id ]['total ' ] = $ this ->voteRepository ->getTotalNumberVotes ($ team ->id );
79
- $ stats [$ team ->id ]['positive ' ] = $ this ->voteRepository ->getTotalNumberPositive ($ team ->id );
80
- $ stats [$ team ->id ]['neutral ' ] = $ this ->voteRepository ->getTotalNumberNeutral ($ team ->id );
81
- $ stats [$ team ->id ]['negative ' ] = $ this ->voteRepository ->getTotalNumberNegative ($ team ->id );
78
+ $ stats [$ team ->id ]['total ' ] = $ this ->voteRepository ->getTotalNumberVotes ($ team ->id , " all " );
79
+ $ stats [$ team ->id ]['positive ' ] = $ this ->voteRepository ->getTotalNumberVotes ($ team ->id , " positive " );
80
+ $ stats [$ team ->id ]['neutral ' ] = $ this ->voteRepository ->getTotalNumberVotes ($ team ->id , " neutral " );
81
+ $ stats [$ team ->id ]['negative ' ] = $ this ->voteRepository ->getTotalNumberVotes ($ team ->id , " negative " );
82
82
}
83
83
84
84
return $ stats ;
@@ -95,9 +95,9 @@ public function getVotesPositive($userId)
95
95
);
96
96
foreach ($ teams as $ team ) {
97
97
$ stats [$ team ->id ]['team_name ' ] = $ team ->team_name ;
98
- $ stats [$ team ->id ]['total ' ] = $ this ->voteRepository ->getTotalNumberVotes ($ team ->id );
98
+ $ stats [$ team ->id ]['total ' ] = $ this ->voteRepository ->getTotalNumberVotes ($ team ->id , " all " );
99
99
$ total = ($ stats [$ team ->id ]['total ' ] > 0 ) ? $ stats [$ team ->id ]['total ' ] : 1 ;
100
- $ stats [$ team ->id ]['percentage ' ] = ceil (($ this ->voteRepository ->getTotalNumberPositive ($ team ->id ) / $ total ) * 100 );
100
+ $ stats [$ team ->id ]['percentage ' ] = ceil (($ this ->voteRepository ->getTotalNumberVotes ($ team ->id , " positive " ) / $ total ) * 100 );
101
101
}
102
102
103
103
return $ stats ;
@@ -112,9 +112,9 @@ public function getVotesNegative($userId)
112
112
);
113
113
foreach ($ teams as $ team ) {
114
114
$ stats [$ team ->id ]['team_name ' ] = $ team ->team_name ;
115
- $ stats [$ team ->id ]['total ' ] = $ this ->voteRepository ->getTotalNumberVotes ($ team ->id );
115
+ $ stats [$ team ->id ]['total ' ] = $ this ->voteRepository ->getTotalNumberVotes ($ team ->id , " all " );
116
116
$ total = ($ stats [$ team ->id ]['total ' ] > 0 ) ? $ stats [$ team ->id ]['total ' ] : 1 ;
117
- $ stats [$ team ->id ]['percentage ' ] = ceil (($ this ->voteRepository ->getTotalNumberNegative ($ team ->id ) / $ total ) * 100 );
117
+ $ stats [$ team ->id ]['percentage ' ] = ceil (($ this ->voteRepository ->getTotalNumberVotes ($ team ->id , " negative " ) / $ total ) * 100 );
118
118
}
119
119
120
120
return $ stats ;
@@ -129,9 +129,9 @@ public function getVotesNeutral($userId)
129
129
);
130
130
foreach ($ teams as $ team ) {
131
131
$ stats [$ team ->id ]['team_name ' ] = $ team ->team_name ;
132
- $ stats [$ team ->id ]['total ' ] = $ this ->voteRepository ->getTotalNumberVotes ($ team ->id );
132
+ $ stats [$ team ->id ]['total ' ] = $ this ->voteRepository ->getTotalNumberVotes ($ team ->id , " all " );
133
133
$ total = ($ stats [$ team ->id ]['total ' ] > 0 ) ? $ stats [$ team ->id ]['total ' ] : 1 ;
134
- $ stats [$ team ->id ]['percentage ' ] = ceil (($ this ->voteRepository ->getTotalNumberNeutral ($ team ->id ) / $ total ) * 100 );
134
+ $ stats [$ team ->id ]['percentage ' ] = ceil (($ this ->voteRepository ->getTotalNumberVotes ($ team ->id , " neutral " ) / $ total ) * 100 );
135
135
}
136
136
137
137
return $ stats ;
@@ -150,4 +150,23 @@ public function getMost($userId, $type = "positive")
150
150
{
151
151
152
152
}
153
+
154
+ public function getRadar ($ userId )
155
+ {
156
+ $ teams = $ this ->usersRepository ->getTeamsForUser (
157
+ $ this ->usersRepository ->getUserById ($ userId )
158
+ );
159
+
160
+ $ stats = [];
161
+
162
+ foreach ($ teams as $ team ) {
163
+ $ criteria = $ this ->criteriaRepository ->getAllCriteria ();
164
+ foreach ($ criteria as $ criterion ) {
165
+ $ stats [$ team ->id ][$ criterion ->criterion ]['total ' ] = $ this ->voteRepository ->getTotalNumberVotes ($ team ->id , "all " , $ criterion ->id );
166
+ $ stats [$ team ->id ][$ criterion ->criterion ]['positive ' ] = ceil (($ this ->voteRepository ->getTotalNumberVotes ($ team ->id , "positive " , $ criterion ->id ) / $ stats [$ team ->id ][$ criterion ->criterion ]['total ' ]) * 100 );
167
+
168
+ }
169
+ }
170
+ return $ stats ;
171
+ }
153
172
}
0 commit comments