Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat(inventory) download log as excel #3999

Merged

Conversation

jeremielodi
Copy link
Collaborator

closes #3976

@jeremielodi
Copy link
Collaborator Author

logs_inve

Copy link
Collaborator

@jniles jniles left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few comments here. It would be great to write a test for this code to ensure it continues working as planned.

server/controllers/inventory/index.js Show resolved Hide resolved
unit_weight : 'FORM.LABELS.WEIGHT',
};

const dictionary = util.loadDictionary(lang);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

server/controllers/inventory/index.js Outdated Show resolved Hide resolved
@@ -38,6 +38,10 @@
</div>
</div>
<div class="modal-footer">
<a target='_blank' class="btn btn-primary" data-method="close" href="/inventory/download/log/{{$ctrl.inventory.uuid}}?lang={{$ctrl.lang}}">
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The data-method=close will confuse our end to end tests. Could you remove it?

// get inventory log as excel
// GET /inventory/download/log/:uuid?rendere=xlsx?lang=fr

async function logDownLoad(req, res, next) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice to have an integration test for this functionality, to at least show it still works. Could you write one?


lines.push({
column1 : _.get(dictionary, 'FORM.LABELS.INVENTORY'),
column2 : inventory[0].label || '',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there ever a case where inventory[0].label won't be defined? If so, what happens?

@jeremielodi jeremielodi force-pushed the inventory_log-download branch 2 times, most recently from e86bc5f to 5d5e50f Compare November 18, 2019 10:31
Copy link
Collaborator

@jniles jniles left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few more nit-picky changes.

@@ -88,6 +95,76 @@ function inventoryLog(req, res, next) {
}).catch(next);
}

// get inventory log as excel
// GET /inventory/download/log/:uuid?rendere=xlsx?lang=fr
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This URL doesn't match what the actual URL is. Can you change the parameters to reflect that?

it('GET /inventory/download/log/?lang=fr donwload log as Ms excel', () => {
return agent.get(`/inventory/download/log/${inventoryUuid}?lang=fr`)
.then(res => {
expect(res).to.have.status(200);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you check the content type to make sure it is the correct content type?

@jniles
Copy link
Collaborator

jniles commented Dec 2, 2019

@jeremielodi can you make the changes to this PR for it it be merged?

@jeremielodi jeremielodi force-pushed the inventory_log-download branch 2 times, most recently from 64554bd to 912edae Compare December 3, 2019 13:22
@jeremielodi jeremielodi force-pushed the inventory_log-download branch from 912edae to 934b07d Compare December 4, 2019 14:43
Copy link
Collaborator

@jniles jniles left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

bors r+

bors bot added a commit that referenced this pull request Dec 4, 2019
3999: Feat(inventory) download log as excel r=jniles a=jeremielodi

closes #3976

Co-authored-by: jeremielodi <jeremielodi@gmail.com>
@bors
Copy link
Contributor

bors bot commented Dec 4, 2019

@bors bors bot merged commit 934b07d into Third-Culture-Software:master Dec 4, 2019
@jeremielodi jeremielodi deleted the inventory_log-download branch October 1, 2021 10:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow users to download inventory history change as Excel.
3 participants