Skip to content

Commit 9ca6c33

Browse files
committed
Use ROR ID to assign Thoth affiliations
Issue: documentacao-e-tarefas/desenvolvimento_e_infra#995 Signed-off-by: Thiago Brasil <thiago@lepidus.com.br>
1 parent c4138d0 commit 9ca6c33

3 files changed

Lines changed: 6 additions & 6 deletions

File tree

classes/services/ThothAffiliationService.inc.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ public function __construct($repository)
2525
$this->repository = $repository;
2626
}
2727

28-
public function register($affiliation, $thothContributionId)
28+
public function register($rorId, $thothContributionId)
2929
{
30-
$thothInstitution = ThothRepository::institution()->find($affiliation);
30+
$thothInstitution = ThothRepository::institution()->find($rorId);
3131

3232
if ($thothInstitution === null) {
3333
return null;

classes/services/ThothContributionService.inc.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ public function register($author, $thothWorkId, $primaryContactId = null)
4848

4949
$thothContributionId = $this->repository->add($thothContribution);
5050

51-
if ($affiliation = $author->getLocalizedAffiliation()) {
52-
ThothService::affiliation()->register($affiliation, $thothContributionId);
51+
if ($rorId = $author->getData('rorId')) {
52+
ThothService::affiliation()->register($rorId, $thothContributionId);
5353
}
5454

5555
return $thothContributionId;

tests/classes/services/ThothAffiliationServiceTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,11 @@ public function testRegisterAffiliation()
6060
->method('add')
6161
->will($this->returnValue('43f98edb-ac8c-45b4-9faa-2941a05c133c'));
6262

63-
$affiliation = 'My Affiliation Institution';
63+
$rorId = 'https://ror.org/00101234';
6464
$thothContributionId = '7315563c-e5c3-40b2-8558-8d1f9cede901';
6565

6666
$service = new ThothAffiliationService($mockRepository);
67-
$thothAffiliationId = $service->register($affiliation, $thothContributionId);
67+
$thothAffiliationId = $service->register($rorId, $thothContributionId);
6868

6969
$this->assertSame('43f98edb-ac8c-45b4-9faa-2941a05c133c', $thothAffiliationId);
7070
}

0 commit comments

Comments
 (0)