Skip to content

Commit

Permalink
Merge branch 'removeNotFoundDataset-584' into 'main'
Browse files Browse the repository at this point in the history
Delete dataset data from database when dataset not found in Dataverse

See merge request softwares-pkp/plugins_ojs/dataverse!140
  • Loading branch information
thiagolepidus committed Aug 28, 2023
2 parents b6f9be9 + 7c05e9e commit 7c93ebe
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
5 changes: 5 additions & 0 deletions classes/dispatchers/DatasetTabDispatcher.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,12 @@ private function getDatasetTabContent(Submission $submission): string
$dataset = $dataverseClient->getDatasetActions()->get($study->getPersistentId());
return $this->plugin->getTemplateResource('datasetTab/datasetData.tpl');
} catch (DataverseException $e) {
if ($e->getCode() === 404) {
DAORegistry::getDAO('DataverseStudyDAO')->deleteStudy($study);
}

error_log('Dataverse API error: ' . $e->getMessage());

$templateMgr = TemplateManager::getManager(Application::get()->getRequest());
$templateMgr->assign('errorMessage', $e->getMessage());
return $this->plugin->getTemplateResource('datasetTab/researchDataError.tpl');
Expand Down
1 change: 1 addition & 0 deletions cypress/tests/Test02_ResearchDataState.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ describe('Research data state', function () {
cy.get('button[aria-controls="datasetTab"]').click();

cy.get('button').contains('Upload research data').click();
cy.wait(1000);
cy.contains('Add research data').click();
cy.wait(1000);
cy.fixture('dummy.pdf', 'base64').then((fileContent) => {
Expand Down
2 changes: 1 addition & 1 deletion templates/datasetTab/researchDataError.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
</pkp-header>
<span class="value">
<p>
{translate key="plugins.generic.dataverse.notification.connectionError" errorMessage=$errorMessage}
{translate key="plugins.generic.dataverse.error.getFailed" error=$errorMessage}
</p>
</span>
</section>
4 changes: 2 additions & 2 deletions version.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
<version>
<application>dataverse</application>
<type>plugins.generic</type>
<release>2.4.2.0</release>
<date>2023-08-21</date>
<release>2.4.3.0</release>
<date>2023-08-28</date>
<lazy-load>1</lazy-load>
<class>DataversePlugin</class>
</version>

0 comments on commit 7c93ebe

Please sign in to comment.