Skip to content

Commit

Permalink
Update method for fetching Competitors and Experts
Browse files Browse the repository at this point in the history
  • Loading branch information
fabian committed Nov 17, 2023
1 parent 8ed5c20 commit 7eb9e57
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions blocks/worldskills_people/controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,12 @@ class Controller extends BlockController
{
const BASE_POSITION_COMPETITOR = 'Competitor';

const BASE_POSITION_COMPETITOR_ID = 4;

const BASE_POSITION_EXPERT = 'Expert';

const BASE_POSITION_EXPERT_ID = 1;

protected $btTable = 'btWorldSkillsPeople';
protected $btInterfaceWidth = 400;
protected $btInterfaceHeight = 400;
Expand Down Expand Up @@ -110,16 +114,16 @@ public function save($args)
public function getPeople($params)
{
$uh = \Core::make('helper/url');
$url = \Config::get('worldskills.api_url', 'https://api.worldskills.org') . '/people';
$url = \Config::get('worldskills.api_url', 'https://api.worldskills.org') . '/people/public';

// Competitors resource
if ($this->typeFilter == 'competitors') {
$url .= '/competitors';
$params['base_position'] = self::BASE_POSITION_COMPETITOR_ID;
}

// Experts resource
if ($this->typeFilter == 'experts') {
$url .= '/experts';
$params['base_position'] = self::BASE_POSITION_EXPERT_ID;
}

// build URL with params
Expand Down

0 comments on commit 7eb9e57

Please sign in to comment.