Skip to content

Commit

Permalink
fixed a bug
Browse files Browse the repository at this point in the history
  • Loading branch information
ashaban committed Jan 5, 2022
1 parent 2245ae9 commit c51041d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
13 changes: 4 additions & 9 deletions gofr-backend/lib/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -696,21 +696,16 @@ app.post('/uploadCSV', (req, res) => {
logger.info(`Uploading data for ${database} now`);
mcsd.CSVTomCSD(files[fileName].path, fields, database, clientId, () => {
logger.info(`Data upload for ${database} is done`);
const uploadReqPro = JSON.stringify({
uploadReqPro = JSON.stringify({
status: 'Done',
error: null,
percent: 100,
});
redisClient.set(uploadRequestId, uploadReqPro);
});
}).catch((err) => {
logger.error(err);
const uploadReqPro = JSON.stringify({
status: 'Error',
error: 'An error has occured, upload cancelled',
percent: null,
});
redisClient.set(uploadRequestId, uploadReqPro);
}).catch(() => {
logger.error('Error occured while creating partition');
return res.status(500).json({ error: 'An error has occured, upload cancelled' });
});
});
});
Expand Down
3 changes: 3 additions & 0 deletions gofr-backend/lib/hapi.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ function addPartition({
},
data: parameters,
};
logger.error(JSON.stringify(options, 0, 2));
axios(options).then(() => {
const resource = {
resourceType: 'Basic',
Expand Down Expand Up @@ -118,10 +119,12 @@ function addPartition({
logger.info(`Partition with name ${name} added successfully`);
return resolve(`Basic/${response.id}`);
}).catch((err) => {
logger.error('Failed to add partition into data sources');
logger.error(err);
return reject(err);
});
}).catch((err) => {
logger.error('Failed to create partition');
logger.error(err);
reject(err);
});
Expand Down
4 changes: 2 additions & 2 deletions gofr-backend/lib/mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -240,12 +240,12 @@ module.exports = {

function populateData(headerMapping, data, reason, invalid) {
const row = {};
for (const header of headerMapping) {
for (const header in headerMapping) {
if (header == 'null') {
return nxtHeader();
}
if (!data.hasOwnProperty(header)) {
return nxtHeader();
continue;
}
row[header] = data[header];
}
Expand Down

0 comments on commit c51041d

Please sign in to comment.