Commit ba83c2b3936e7950c484d72147f7e1b71282176a
1 parent
8458d742
-1 fix
Showing
3 changed files
with
4 additions
and
4 deletions
Show diff stats
frontend/controllers/CabinetController.php
... | ... | @@ -213,8 +213,7 @@ |
213 | 213 | ->all(); |
214 | 214 | } else { |
215 | 215 | $reports = Report::find() |
216 | - ->joinWith('intellectualProperty.creativeRoles') | |
217 | - ->where([ 'creative_role.user_id' => $user->id ]) | |
216 | + ->innerJoinWith('intellectualProperty.creativeRole') | |
218 | 217 | ->all(); |
219 | 218 | } |
220 | 219 | ... | ... |
frontend/models/IntellectualProperty.php
... | ... | @@ -97,7 +97,7 @@ |
97 | 97 | public function getCreativeRole() |
98 | 98 | { |
99 | 99 | return $this->hasOne(CreativeRole::className(), [ 'intellectual_property_id' => 'id' ]) |
100 | - ->where([ 'user_id' => \Yii::$app->user->id ]); | |
100 | + ->where([ 'creative_role.user_id' => \Yii::$app->user->id ]); | |
101 | 101 | } |
102 | 102 | |
103 | 103 | /** | ... | ... |
frontend/views/cabinet/users.php
... | ... | @@ -3,6 +3,7 @@ |
3 | 3 | use frontend\models\IntellectualProperty; |
4 | 4 | use frontend\models\Report; |
5 | 5 | use yii\helpers\Html; |
6 | + use yii\helpers\VarDumper; | |
6 | 7 | use yii\web\View; |
7 | 8 | use yii\widgets\ActiveForm; |
8 | 9 | use yii\widgets\Pjax; |
... | ... | @@ -58,7 +59,7 @@ |
58 | 59 | if ($user->isAdmin()) { |
59 | 60 | $sum = $report->sum; |
60 | 61 | } else { |
61 | - $sum = $report->sum * $report->intellectualProperty->creativeRoles[0]->part / 100; | |
62 | + $sum = $report->sum * $report->intellectualProperty->creativeRole->part / 100; | |
62 | 63 | } |
63 | 64 | $total += $sum*0.8*0.805; |
64 | 65 | ?> | ... | ... |