Skip to content

Commit

Permalink
Merge branch 'selectAllSections330-694' into 'stable-3_3_0'
Browse files Browse the repository at this point in the history
Adiciona botão para selecionar todas as seções - 330

See merge request softwares-pkp/plugins_ojs/relatorioscielo!26
  • Loading branch information
JhonathanLepidus committed Aug 19, 2024
2 parents a012bb5 + 0e9d147 commit 430a580
Show file tree
Hide file tree
Showing 7 changed files with 159 additions and 9 deletions.
4 changes: 2 additions & 2 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ variables:

include:
- project: 'documentacao-e-tarefas/modelosparaintegracaocontinua'
ref: main
ref: stable-3_3_0
file:
- 'templates/groups/pkp_plugin.yml'
- 'templates/groups/ops_plugins_unit_tests_model.yml'
- 'templates/groups/ops/unit_tests.yml'
114 changes: 114 additions & 0 deletions cypress/tests/Test1_reportGeneration.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
function getNowDateAndHour() {
let now = new Date().toISOString();
const charactersToRemove = ['-', ':', 'T'];
let nowFormatted = '';

for (let i = 0; i < now.length; i++) {
let shouldRemove = false;

for (let j = 0; j < charactersToRemove.length; j++) {
if (now[i] === charactersToRemove[j]) {
shouldRemove = true;
break;
}
}

if (!shouldRemove) {
nowFormatted += now[i];
}
}

return (nowFormatted.split('.')[0]);
}

describe("SciELO Submissions Report - Report generation", function() {
it("Asserts presence of report setting fields", function() {
cy.login('dbarnes', null, 'publicknowledge');

cy.contains('a.app__navItem', 'Reports').click();
cy.contains('a', 'SciELO Submissions Report').click();

cy.contains('h2', 'Period');
cy.contains('Select the desired filtering type:');
cy.get('#selectFilterTypeDate').within(() => {
cy.contains('option', 'Filter by submitted date');
cy.contains('option', 'Filter by final decision date');
cy.contains('option', 'Filter by submitted date and final decision');
});
cy.get('#selectFilterTypeDate').select('Filter by submitted date');
cy.contains('Submitted date range');
cy.get('#selectFilterTypeDate').select('Filter by final decision date');
cy.contains('Final decision date range');
cy.get('#selectFilterTypeDate').select('Filter by submitted date and final decision');
cy.contains('Submitted date range');
cy.contains('Final decision date range');
cy.get('#selectFilterTypeDate').select('Filter by submitted date');

cy.contains('h2', 'Sections');
cy.contains('label', 'Articles');
cy.contains('label', 'Reviews');

cy.contains('The report generation proccesss can take a few minutes, depending on the parameters selected and the number of submissions present in the system.');
cy.contains('input', 'Generate Report');
});
it('Generates CSV report', function () {
cy.login('dbarnes', null, 'publicknowledge');

cy.contains('a.app__navItem', 'Reports').click();
cy.contains('a', 'SciELO Submissions Report').click();

cy.get('#selectFilterTypeDate').select('Filter by submitted date');
cy.contains('label', 'Articles').parent().within(() => {
cy.get('input').check();
});
cy.contains('label', 'Reviews').parent().within(() => {
cy.get('input').check();
});

cy.contains('Generate Report').click();
cy.wait(2000);

let now = getNowDateAndHour();
const downloadsFolder = Cypress.config('downloadsFolder');
const reportFileName = 'submissionsJPKJPK-' + now + '.csv';

cy.readFile(downloadsFolder + reportFileName, 'utf-8').then((text) => {
expect(text).to.contain('Articles,Reviews');
});
});
it('Generates CSV using field to select all sections', function () {
cy.login('dbarnes', null, 'publicknowledge');

cy.contains('a.app__navItem', 'Reports').click();
cy.contains('a', 'SciELO Submissions Report').click();

cy.get('#selectFilterTypeDate').select('Filter by submitted date');
cy.get('#selectAllSections').check();
cy.contains('label', 'Articles').parent().within(() => {
cy.get('input').should('be.checked');
});
cy.contains('label', 'Reviews').parent().within(() => {
cy.get('input').should('be.checked');
});

cy.get('#selectAllSections').uncheck();
cy.contains('label', 'Articles').parent().within(() => {
cy.get('input').should('not.be.checked');
});
cy.contains('label', 'Reviews').parent().within(() => {
cy.get('input').should('not.be.checked');
});

cy.get('#selectAllSections').check();
cy.contains('Generate Report').click();
cy.wait(2000);

let now = getNowDateAndHour();
const downloadsFolder = Cypress.config('downloadsFolder');
const reportFileName = 'submissionsJPKJPK-' + now + '.csv';

cy.readFile(downloadsFolder + reportFileName, 'utf-8').then((text) => {
expect(text).to.contain('Articles,Reviews');
});
});
});
3 changes: 3 additions & 0 deletions locale/en_US/locale.po
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ msgstr "Period"
msgid "plugins.reports.scieloSubmissionsReport.sections"
msgstr "Sections"

msgid "plugins.reports.scieloSubmissionsReport.selectAllSections"
msgstr "Sellect all sections"

msgid "plugins.reports.scieloSubmissionsReport.checkboxIncludeViews"
msgstr "Include in the report the numbers of views of submissions"

Expand Down
3 changes: 3 additions & 0 deletions locale/es_ES/locale.po
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ msgstr "Período"
msgid "plugins.reports.scieloSubmissionsReport.sections"
msgstr "Secciones"

msgid "plugins.reports.scieloSubmissionsReport.selectAllSections"
msgstr "Seleccionar todas las secciones"

msgid "plugins.reports.scieloSubmissionsReport.checkboxIncludeViews"
msgstr "Incluir los números de acceso de los envíos en el informe"

Expand Down
3 changes: 3 additions & 0 deletions locale/pt_BR/locale.po
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ msgstr "Período"
msgid "plugins.reports.scieloSubmissionsReport.sections"
msgstr "Seções"

msgid "plugins.reports.scieloSubmissionsReport.selectAllSections"
msgstr "Selecionar todas as seções"

msgid "plugins.reports.scieloSubmissionsReport.checkboxIncludeViews"
msgstr "Incluir no relatório os números de acessos das submissões"

Expand Down
37 changes: 32 additions & 5 deletions templates/scieloSubmissionsReportPlugin.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,16 @@
{if $sections|@count > 0}
<h2>{translate key="plugins.reports.scieloSubmissionsReport.sections"}</h2>
<table>
<div class= "pkpListPanel">
<div class="pkpListPanel">
<tr>
<td class="value" colspan="2">
{fbvElement type="checkBox" name="selectAllSections" id="selectAllSections" label="plugins.reports.scieloSubmissionsReport.selectAllSections"}
</td>
</tr>
</div>
</table>
<table>
<div class="pkpListPanel">
<tr>
<td class="value" colspan="2">
{fbvElement type="checkBoxGroup" name="sections" id="sections" from=$sections selected=$sections_options translate=false}
Expand Down Expand Up @@ -103,12 +112,14 @@

<script>
$(function() {ldelim}
var filterTypeSelection = document.getElementById('selectFilterTypeDate');
var submissionDiv = document.getElementById('submittedDateFields');
var decisionDiv = document.getElementById('finalDecisionDateFields');
let filterTypeSelection = document.getElementById('selectFilterTypeDate');
let submissionDiv = document.getElementById('submittedDateFields');
let decisionDiv = document.getElementById('finalDecisionDateFields');
let selectAllSections = document.getElementById('selectAllSections');
let sectionCheckboxes = document.querySelectorAll('input[name="sections[]"]');
filterTypeSelection.addEventListener("change", function(){ldelim}
var selectedValue = filterTypeSelection.value;
let selectedValue = filterTypeSelection.value;
if(selectedValue == "filterBySubmission"){ldelim}
submissionDiv.hidden = false;
decisionDiv.hidden = true;
Expand All @@ -122,6 +133,22 @@
decisionDiv.hidden = false;
{rdelim}
{rdelim});
selectAllSections.addEventListener("change", function() {ldelim}
let isChecked = selectAllSections.checked;
for (let sectionCheckbox of sectionCheckboxes) {ldelim}
sectionCheckbox.checked = isChecked;
{rdelim}
{rdelim});
for (let sectionCheckbox of sectionCheckboxes) {ldelim}
sectionCheckbox.addEventListener("change", function() {ldelim}
if (!sectionCheckbox.checked && selectAllSections.checked) {ldelim}
selectAllSections.checked = false;
{rdelim}
{rdelim});
{rdelim}
{rdelim});
</script>

Expand Down
4 changes: 2 additions & 2 deletions version.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<version>
<application>scieloSubmissionsReport</application>
<type>plugins.reports</type>
<release>2.4.2.0</release>
<date>2024-03-25</date>
<release>2.4.3.0</release>
<date>2024-08-19</date>
<lazy-load>1</lazy-load>
<class>ScieloSubmissionsReportPlugin</class>
</version>

0 comments on commit 430a580

Please sign in to comment.