Removed achievements from profile search form filters. Added doc for api/profile

This commit is contained in:
Korzinkayablok
2021-09-15 16:14:08 +03:00
parent ad947826a0
commit 6c14d4c7e1
2 changed files with 78 additions and 19 deletions

View File

@ -20,7 +20,6 @@ class ProfileSearchForm extends Model
public $limit = 10;
public $offset = 0;
public $skills;
public $achievements;
public $position_id;
public $id;
@ -30,7 +29,6 @@ class ProfileSearchForm extends Model
return [
[['id', 'limit', 'offset', 'position_id'], 'safe'],
[['skills'], 'checkIsArray'],
[['achievements'], 'checkIsArray'],
];
}
@ -71,20 +69,12 @@ class ProfileSearchForm extends Model
$model->joinWith('skillValues');
}
if($this->achievements){
$model->joinWith(['achievements']);
$this->achievements = explode(',', $this->achievements);
$model->where(['achievement_user_card.achievement_id' => $this->achievements]);
$model->having('COUNT(DISTINCT achievement_id) = ' . count($this->achievements));
}
else{
$model->joinWith('achievements');
}
$model->joinWith('achievements');
$model->andFilterWhere(['position_id' => $this->position_id]);
$model->andWhere(['status' => [4, 12]]);
$model->andWhere(['deleted_at' => null]);
// $model->andFilterWhere(['position_id' => $this->position_id]);
//
// $model->andWhere(['status' => [4, 12]]);
// $model->andWhere(['deleted_at' => null]);
$model->groupBy('card_skill.card_id');