Skip to content

Commit

Permalink
Merge pull request #71 from shikshalokam/taskFix
Browse files Browse the repository at this point in the history
fix task
  • Loading branch information
aks30 authored Mar 2, 2022
2 parents e9ff451 + c0c9501 commit 1b9f8b2
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions module/userProjects/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ const projectQueries = require(DB_QUERY_BASE_PATH + "/projects");
const projectCategoriesQueries = require(DB_QUERY_BASE_PATH + "/projectCategories");
const projectTemplateQueries = require(DB_QUERY_BASE_PATH + "/projectTemplates");
const projectTemplateTaskQueries = require(DB_QUERY_BASE_PATH + "/projectTemplateTask");

const kafkaProducersHelper = require(GENERICS_FILES_PATH + "/kafka/producers");
const removeFieldsFromRequest = ["submissionDetails"];

/**
* UserProjectsHelper
Expand Down Expand Up @@ -271,10 +271,16 @@ module.exports = class UserProjectsHelper {
task
);
} else {

let keepFieldsFromTask = ["observationInformation", "submissions"];

if (userProject[0].tasks[taskIndex].submissions) {
task.submissions = userProject[0].tasks[taskIndex].submissions;
}
removeFieldsFromRequest.forEach((removeField) => {
delete userProject[0].tasks[taskIndex][removeField];
});

keepFieldsFromTask.forEach((field) => {
task.field = userProject[0].tasks[taskIndex][field] ? userProject[0].tasks[taskIndex][field] : null;
});

userProject[0].tasks[taskIndex] = task;
}
Expand Down Expand Up @@ -2235,7 +2241,11 @@ function _projectTask(tasks, isImportedFromLibrary = false, parentTaskId = "") {
});
}
}


removeFieldsFromRequest.forEach((removeField) => {
delete singleTask[removeField];
});

if (singleTask.children) {
_projectTask(
singleTask.children,
Expand Down

0 comments on commit 1b9f8b2

Please sign in to comment.