Skip to content

#4048 tasks for work packages#4098

Open
getheobald wants to merge 22 commits intodevelopfrom
#4048-tasks-for-work-packages
Open

#4048 tasks for work packages#4098
getheobald wants to merge 22 commits intodevelopfrom
#4048-tasks-for-work-packages

Conversation

@getheobald
Copy link
Copy Markdown
Contributor

@getheobald getheobald commented Mar 27, 2026

Changes

There's a new Tasks tab on work packages that shows tasks associated with that work package. The project tasks tab shows all tasks associated with that project, including tasks on its wp's tasks. A task's WP can be edited or deleted.

Backend

  • Task schema already had wbsElement field which can be a project or wp (or car), but there was nothing above schema level that supported it
  • Changed getWorkPackageQueryArgs to return task info so transformer can get tasks from it
  • Changed project transformer to include all the project's wp's tasks
  • Added editTaskWbsElement throughout stack to handle edits

Frontend

  • Added optional WP dropdown to new task modal on Project tasks tab
  • Display WP chip on task card on Project tasks tab but not WP tasks tab
  • Added WP line to task detail modal on Project tasks tab
  • Made sure Project tasks tab shows all its tasks and all its work packages' tasks
  • Show tasks tab on WP detail page, filtered for only that WP's tasks
  • Don't show WP dropdown on WP tasks page

Notes

  • Do people ever create tasks from the gantt chart? Just realized you can, and I didn't put the WP dropdown on the new task modal that pops up from gantt chart. I could, but does anyone even do that? It's also super easy to edit once you're back on the project page. But I can add that in if you want.
  • I can change the color/design of the chip!!!! Super open to changes there
  • validateInputs was missing from some post requests in tasks routes so I added it but I know that was out of the scope of this ticket
  • Teams references in the tasks frontend weren't used anywhere so I deleted them
  • There's technically a known theoretical edge case I didn't prevent against but there's like no way for it to ever happen unless someone adds in Work Package selection UI in WP tasks page (why would you) ... if workPackages is undefined (i.e. the task is on a WP) AND somehow wpWbsNum is set, targetWbsElementId would be undefined, so the if (targetWbsElementId) check fails the api call is skipped and the WP change is never saved, but no error is shown. But this won't happen in practice because the WP dropdown is hidden in the WP context so wpWbsNum can never be set to anything new there

Test Cases

  • Throw error when guests try to edit work package
  • Throw error when task doesn't exist
  • Throw error when task was deleted
  • Throw error when new work package doesn't exist
  • Throw error when new work package was deleted
  • Successfully update work package

Screenshots

Task Form Modal in projects page tasks tab
image

image image

Task Modal on projects page tasks tab shows wp as line item
image

Projects page, containing tasks associated with wps
image

You can't see my cursor but they're clickable and highlight when hovered over
image

WP page now has a tasks tab, filtered for only that wp's tasks, which don't show chips because they're obviously on that wp
image

No option to choose wp when creating task from wp page - they're automatically associated with the relevant wp
image

Checklist

  • All commits are tagged with the ticket number
  • No linting errors / newline at end of file warnings
  • All code follows repository-configured prettier formatting
  • No merge conflicts
  • All checks passing
  • Screenshots of UI changes (see Screenshots section)
  • Remove any non-applicable sections of this template
  • Assign the PR to yourself
  • No yarn.lock changes (unless dependencies have changed)
  • Request reviewers & ping on Slack
  • PR is linked to the ticket (fill in the closes line below)

Closes #4048

@getheobald getheobald self-assigned this Mar 27, 2026
Copy link
Copy Markdown
Contributor

@chpy04 chpy04 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good start, couple notes:

  1. If I'm editting a task from the wp task kanban, I should still be able to change the task's work package
  2. I should be able to edit a task and remove the work package
  3. Saw ur slack but yes we need to support select a wp via gantt chart as well

}
}

static async editTaskWbsElement(req: Request, res: Response, next: NextFunction) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unless we have different permissions (which I don't think we do) we should just add a wbselement param to the edit and then use that route instead of this

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah makes sense. I separated it cause I saw that assignees and status were separated but I guess those have valid reasons and this doesn't, so I'll throw it in with editTask

blocking: { where: { wbsElement: { dateDeleted: null } }, include: { wbsElement: true } },
descriptionBullets: { where: { dateDeleted: null }, ...getDescriptionBulletQueryArgs(organizationId) }
descriptionBullets: { where: { dateDeleted: null }, ...getDescriptionBulletQueryArgs(organizationId) },
tasks: { where: { dateDeleted: null }, ...getTaskQueryArgs(organizationId) }
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a little concerned about adding this much nested information to the generic work package query args. Can we instead make a seperate endpoint to get the tasks for a specific work package and then use that? Could also just make a get task by wbs element and then abstract it for both project and wp task page

'easy to forget McCauley, in his blue racing jacket and jet black helmet, is racing laps around the roof of ' +
"Columbus Parking Garage on Northeastern's Boston campus. But that's the reality of Northeastern Electric " +
'Racing, a student club that has made due and found massive success in the world of electric racing despite its ' +
'Racing, a student club that has made do and found massive success in the world of electric racing despite its ' +
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😭

},
workPackage: {
include: {
project: {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you already have this information at the project level above so this is redundant

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not, because project and wp are mutually exclusive on a wbs element. If createTask is called on a project, requestedWbsElement.project is populated and requestedWbsElement.workPackage is null, and vice versa for if called on a wp. So I think we need both full includes in the query because only one will actually return.

* @returns the updated task
* @throws if the task does not exist, the task is already deleted, the wbs element doesn't exist, or if the user does not have permissions
*/
static async editTaskWbsElement(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above, lets just group this in with edit task

project: Project;
wbsNum: WbsNumber;
wbsElementId: string;
workPackages?: WorkPackage[];
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same thing here the task column component should not need a list of work packages

tasks: Task[];
wbsNum: WbsNumber;
wbsElementId: string;
workPackages?: WorkPackage[];
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

title: yup.string().required(),
taskId: yup.string().required()
taskId: yup.string().required(),
wpWbsNum: yup.mixed<WbsNumber>().optional()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pretty sure yup.mixed is used when it could be one of a number of different primative types. In this case you could just do string. If you wanted to specifcally ensure its a wbsnumber you could add a test function for that but because users aren't manually typing in numbers I think its fine to just say string.

onHide: () => void;
onSubmit: (data: EditTaskFormInput) => Promise<void>;
onReset?: () => void;
workPackages?: WorkPackage[];
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

teamTypes: TeamType[];
projectId: string;
events: EventPreview[];
tasks: Task[];
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same, would really like to remove this

@getheobald
Copy link
Copy Markdown
Contributor Author

Good start, couple notes:

  1. If I'm editting a task from the wp task kanban, I should still be able to change the task's work package
  2. I should be able to edit a task and remove the work package
  3. Saw ur slack but yes we need to support select a wp via gantt chart as well
  1. That was a design decision - ticket specified that I should lock wp selection within wp task kanban (I decided to omit it entirely). I can change it if you like! I don't want to let users create a task with any wp from wp task kanban, partly because it doesn't make sense and partly because people will get confused if they accidentally click the wrong one and then the created task doesn't appear anywhere on the page, but if editing is important I could add that
  2. You can; there's an X on the right side of the dropdown. Do you think it needs to be more visually obvious? (UX question not insult)
  3. Ok will add

@getheobald
Copy link
Copy Markdown
Contributor Author

I lied I read the ticket more carefully and I guess the main spec was that it's locked in the wp task kanban creation modal, but I do see the value of editing there. So yes I'll add that back in!

@chpy04
Copy link
Copy Markdown
Contributor

chpy04 commented Mar 27, 2026

I think its always better to give the user the option so I'd prefer to always let them edit the wp but then if they create from within a work package it should default to the wp they are in so lets always have the field regardless. In terms of removing the wp, when I tested it the x wasn't working for editting an already created task on a wp, but let me know if you are unable to reproduce

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Maintenance] - Allow tasks to be assigned to work packages

2 participants