working on tasks for meteor 3 update

This commit is contained in:
Brian McGonagill 2025-06-24 13:16:42 -05:00
parent f12c6bb7c8
commit ca7bcb1a8f
2 changed files with 23 additions and 9 deletions

View file

@ -47,7 +47,7 @@ Template.myTasksForm.events({
} }
} }
console.log("Date Error: " + taskDateErr + " - Name Error: " + taskNameErr); // console.log("Date Error: " + taskDateErr + " - Name Error: " + taskNameErr);
if (taskDateErr == false && taskNameErr == false) { if (taskDateErr == false && taskNameErr == false) {
const addTask = async() => { const addTask = async() => {
let result = await Meteor.callAsync("add.task", taskNameArray, "self", "selfId", taskDateArray, actDate); let result = await Meteor.callAsync("add.task", taskNameArray, "self", "selfId", taskDateArray, actDate);

View file

@ -25,6 +25,7 @@ Meteor.methods({
} }
let username; let username;
let usInfo;
if (assignedTo == "self") { if (assignedTo == "self") {
const uInfo = async() => { const uInfo = async() => {
@ -34,21 +35,29 @@ Meteor.methods({
} else { } else {
username = userInfo.profile.fullname; username = userInfo.profile.fullname;
assignedToId = this.userId; assignedToId = this.userId;
let usInf = { "username": username, "assignedToId": assignedToId };
console.log("setting username = " + username +", and id = " + assignedToId);
return usInf;
} }
} }
uInfo(); usInfo = uInfo();
console.dir(usInfo);
} else { } else {
username = assignedTo; username = assignedTo;
usInfo = { "username": assignedTo, "assignedToId": assignedToId };
console.log("Set username = " + assignedTo);
} }
for (i=0; i < taskDateArr.length; i++) { console.log("assignedToId = " + usInfo.assignedToId);
for (j=0; j < taskNameArr.length; j++) {
for (let i=0; i < taskDateArr.length; i++) {
for (let j=0; j < taskNameArr.length; j++) {
TaskItems.insertAsync({ TaskItems.insertAsync({
taskName: taskNameArr[j].id, taskName: taskNameArr[j].id,
taskDate: taskDateArr[i], taskDate: taskDateArr[i],
actualDate: actDate[i], actualDate: actDate[i],
assignedTo: username, assignedTo: usInfo.username,
assignedToId: assignedToId, assignedToId: usInfo.assignedToId,
isComplete: false, isComplete: false,
completedOn: null, completedOn: null,
assignedOn: new Date(), assignedOn: new Date(),
@ -56,6 +65,7 @@ Meteor.methods({
}); });
} }
} }
return;
}, },
'add.mytask' (taskName, assignedTo, assignedToId, taskDate, actDate) { 'add.mytask' (taskName, assignedTo, assignedToId, taskDate, actDate) {
check(taskName, String); check(taskName, String);
@ -67,6 +77,7 @@ Meteor.methods({
} }
let username; let username;
let usInfo;
if (assignedTo == "self") { if (assignedTo == "self") {
const uInfo = async() => { const uInfo = async() => {
@ -76,19 +87,22 @@ Meteor.methods({
} else { } else {
username = userInfo.profile.fullname; username = userInfo.profile.fullname;
assignedToId = this.userId; assignedToId = this.userId;
let usinf = { username: username, assignedToId: assignedToId };
return usinf;
} }
} }
uInfo(); usInfo = uInfo();
} else { } else {
username = assignedTo; username = assignedTo;
usInfo = { username: assignedTo, assignedToId: assignedToId };
} }
return TaskItems.insertAsync({ return TaskItems.insertAsync({
taskName: taskName, taskName: taskName,
taskDate: taskDate, taskDate: taskDate,
actualDate: actDate, actualDate: actDate,
assignedTo: username, assignedTo: usInfo.username,
assignedToId: assignedToId, assignedToId: usInfo.assignedToId,
isComplete: false, isComplete: false,
completedOn: null, completedOn: null,
assignedOn: new Date(), assignedOn: new Date(),