-
Notifications
You must be signed in to change notification settings - Fork 105
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
Feat(inventory) download log as excel #3999
Conversation
There was a problem hiding this 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.
unit_weight : 'FORM.LABELS.WEIGHT', | ||
}; | ||
|
||
const dictionary = util.loadDictionary(lang); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
@@ -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}}"> |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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 || '', |
There was a problem hiding this comment.
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?
e86bc5f
to
5d5e50f
Compare
There was a problem hiding this 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 |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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?
@jeremielodi can you make the changes to this PR for it it be merged? |
64554bd
to
912edae
Compare
912edae
to
934b07d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
bors r+
closes #3976