From d6dad95b48959bba6a80358f064a554e7cb211c4 Mon Sep 17 00:00:00 2001 From: Sebastian Marcet Date: Thu, 27 Sep 2018 11:42:42 -0300 Subject: [PATCH] Fix on CFP presentation submission proccess Change-Id: Ibb1f69d16651e998140f2f5924e11c6abfae480a --- .../Summit/Events/Presentations/PresentationCategory.php | 8 ++++---- tests/OAuth2PresentationSubmissionTest.php | 5 +++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/app/Models/Foundation/Summit/Events/Presentations/PresentationCategory.php b/app/Models/Foundation/Summit/Events/Presentations/PresentationCategory.php index 4936d7fc..85856ee5 100644 --- a/app/Models/Foundation/Summit/Events/Presentations/PresentationCategory.php +++ b/app/Models/Foundation/Summit/Events/Presentations/PresentationCategory.php @@ -290,10 +290,10 @@ class PresentationCategory extends SilverstripeBaseModel * @return Tag|null */ public function getAllowedTagByVal($tag_value){ - $criteria = Criteria::create(); - $criteria->where(Criteria::expr()->eq('tag', trim($tag_value))); - $res = $this->allowed_tags->matching($criteria)->first(); - return $res === false ? null : $res; + $res = $this->allowed_tags->filter(function($e) use($tag_value){ + return strtolower(trim($e->getTag())) == strtolower(trim($tag_value)); + }); + return $res->count() > 0 ? $res->first() : null; } /** diff --git a/tests/OAuth2PresentationSubmissionTest.php b/tests/OAuth2PresentationSubmissionTest.php index 56c90f38..29f42cb1 100644 --- a/tests/OAuth2PresentationSubmissionTest.php +++ b/tests/OAuth2PresentationSubmissionTest.php @@ -31,7 +31,7 @@ class OAuth2PresentationSubmissionTest extends ProtectedApiTest 'level' => 'N/A', 'attendees_expected_learnt' => 'super duper', 'type_id' => 171, - 'track_id' => 248, + 'track_id' => 262, 'attending_media' => true, 'links' => ['https://www.google.com'], 'extra_questions' => [ @@ -39,7 +39,8 @@ class OAuth2PresentationSubmissionTest extends ProtectedApiTest 'id' => 24, 'value' => 'test', ] - ] + ], + 'tags' => ['Upstream Development'] ]; $headers = [