Skip to content

Commit

Permalink
Fixes metrics import
Browse files Browse the repository at this point in the history
  • Loading branch information
thiagolepidus committed May 3, 2024
1 parent 643a749 commit 1870a08
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
14 changes: 13 additions & 1 deletion filter/import/NativeXmlJournalFilter.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,7 @@ public function parseArticle($node, $journal)
public function parseMetrics($node, $journal)
{
$deployment = $this->getDeployment();
echo __('plugins.importexport.fullJournal.importingMetrics') . "\n";

$metricKeys = [
'assoc_type', 'day', 'country_id', 'region', 'city', 'file_type', 'metric', 'metric_type', 'load_id'
Expand Down Expand Up @@ -465,7 +466,18 @@ public function parseMetrics($node, $journal)
break;
}
$metricsDAO = DAORegistry::getDAO('MetricsDAO');
$metricsDAO->insertRecord($record);
try {
$metricsDAO->insertRecord($record);
} catch (Exception $e) {
$deployment->addWarning(
ASSOC_TYPE_JOURNAL,
$journal->getId(),
__(
'plugins.importexport.fullJournal.error.metric',
['reason' => $e->getMessage()]
)
);
}
}
}
}
Expand Down
6 changes: 6 additions & 0 deletions locale/en_US/locale.po
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,14 @@ msgstr "Importing issues..."
msgid "plugins.importexport.fullJournal.importingArticles"
msgstr "Importing articles..."

msgid "plugins.importexport.fullJournal.importingMetrics"
msgstr "Importing metrics..."

msgid "plugins.importexport.fullJournal.importCompleted"
msgstr "Import completed successfully"

msgid "plugins.importexport.fullJournal.error.userNotFound"
msgstr "User with email {$email} is not present on the site."

msgid "plugins.importexport.fullJournal.error.metric"
msgstr "Failed to import metric. {$reason}"
6 changes: 6 additions & 0 deletions locale/pt_BR/locale.po
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,14 @@ msgstr "Importando edições..."
msgid "plugins.importexport.fullJournal.importingArticles"
msgstr "Importando artigos..."

msgid "plugins.importexport.fullJournal.importingMetrics"
msgstr "Importando métricas..."

msgid "plugins.importexport.fullJournal.importCompleted"
msgstr "Importação concluída com sucesso"

msgid "plugins.importexport.fullJournal.error.userNotFound"
msgstr "Usuário com email {$email} não está presente no site."

msgid "plugins.importexport.fullJournal.error.metric"
msgstr "Falha ao importar a métrica. {$reason}"

0 comments on commit 1870a08

Please sign in to comment.