-
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
CDR Peremption Reporting Tool #5558
CDR Peremption Reporting Tool #5558
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.
@mbayopanda I've made a few comments. I wonder how we should deploy this. In the short run, we can definitely put it on the online deployment, but it doesn't really make sense for hospital deployments. Do you have any ideas?
@@ -0,0 +1,5 @@ | |||
<div class="ui-grid-cell-contents"> |
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.
What's the purpose of this template?
</tr> | ||
<tr class="highlighted delimitter"> | ||
{{!-- <td class="first">{{date periodKey}}</td> --}} | ||
<td class="first">Tx de péremption</td> |
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.
Would it be possible to translate these values?
const directory = path.join(fsdir, hasTrailingSlash ? prefix : `${prefix}/`); | ||
|
||
// configure the storage space using multer's diskStorage. This will allow | ||
const storage = multer.diskStorage({ |
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.
Correct me if I am wrong, but this looks nearly identical to the uploader definition above.
Could you move the common items out into their own function/object?
I'm imagining:
function setupDiskStorage(prefix, fields) {
// format the upload directory. Add a trailing slash for consistency
const hasTrailingSlash = (prefix[prefix.length - 1] === '/');
const directory = path.join(dir, hasTrailingSlash ? prefix : `${prefix}/`);
// configure the storage space using multer's diskStorage. This will allow
const storage = multer.diskStorage({
destination : async (req, file, cb) => {
try {
// NOTE: need absolute path here for mkdirp
const fullFolderPath = path.join(fsdir, directory);
debug(`creating upload directory ${fullFolderPath}.`);
await mkdirp(fullFolderPath);
cb(null, fullFolderPath);
} catch (err) {
cb(err);
}
},
filename : (req, file, cb) => {
const id = uuid();
// ensure that a link is passed to the req.file object
file.link = `${directory}${id}`;
debug(`Storing file in ${file.link}.`);
cb(null, id);
},
});
}
// then...
function Uploader(prefix, fields) {
const storage = setupDiskStorage(prefix, fields);
return multer({ storage }).array(fields);
}
function multipleFields(prefix, fields) {
const storage = setupDiskStorage(prefix, fields);
return multer({ storage }).fields(fields);
}
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.
You also have the migration script in here, could you remove it?
This PR adds a module for reporting expired rate from CDR
To test it, please import these files :
Article.xlsx
ArticleLot.xlsx
LigneLotDansDoc.xlsx
MouvementStock.xlsx