Skip to content
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

feat(Teacher): Implement unit tagging #276

Merged
merged 24 commits into from
Jul 1, 2024

Conversation

geoffreykwan
Copy link
Member

@geoffreykwan geoffreykwan commented May 23, 2024

Changes

  • Added the ability to create, edit, and delete tags
  • Added the ability to apply and remove tags from units

Run this mysql database query to add the color column to the user_tags table

alter table user_tags add column color varchar(25) after text;

Test

Closes #259

Copy link
Member

@hirokiterashima hirokiterashima left a comment

Choose a reason for hiding this comment

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

The functionality mostly works.

It looks like the number of tags in the message when you try to delete a tag is off. In the screenshot below, you can see that I have "tag3" on a unit, but the cofirmation message says "0" I think it may not be counting the tags that are on the units (as opposed to run units).

Screenshot 2024-05-24 at 3 30 00 PM

I also added some code cleaning suggestions inline.

Lastly, maybe we should also apply the code cleaning conventions for at least the new standalone components, like alphabetizing (imports -> selector -> standalone...), rename "styleUrls" -> "styleUrl", self-closing tags, and such?

@hirokiterashima
Copy link
Member

Oops. The comment above was intended for the WISE-Client PR. I have yet to review this PR.

@hirokiterashima hirokiterashima self-requested a review May 28, 2024 15:49
Copy link
Member

@hirokiterashima hirokiterashima left a comment

Choose a reason for hiding this comment

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

Does this PR need to make changes to wise_db_init.sql?

Also, see inline comments. I wonder if the functions in [UserTag,TagProject]Controller should return the object directly instead of wrapping it in ResponseEntity. I think Spring automatically returns 200 (unless there's an error), and 404 (if the function exists due to an exception)?

@geoffreykwan
Copy link
Member Author

I removed the ResponseEntity from TagProjectController.java. I kept it in the UserTagController.java because the client side looks for the error field to contain 'tagAlreadyExists' to show an error message. I've also updated wise_db_init.sql to include the color column in the user_tags table.

@hirokiterashima
Copy link
Member

For error handling- can we do something similar to how we handle invalid name when creating user accounts?
We throw an InvalidNameException in StudentAPIController.createStudentAccount(), which is handled in register-student-form.component.createAccount(). It looks like we use @ControllerAdvice in CustomGlobalExceptionHandler.java to handle the InvalidNameException and return a ResponseEntity there.

This will separate out the concerns and make the functions in UserTagController easier to read. They won't need to wrap the return value in ResponseEntityGenerator.createSuccess/createError each time.

@geoffreykwan
Copy link
Member Author

Ok, we now throw a TagAlreadyExistsException.

@hirokiterashima
Copy link
Member

See my inline comment in UserTagController. Do we need to use ResponseEntityGenerator?

@geoffreykwan
Copy link
Member Author

Ok, I've removed the usage of ResponseEntityGenerator.

Copy link
Member

@hirokiterashima hirokiterashima left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@breity breity left a comment

Choose a reason for hiding this comment

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

Looks good. 👍

@geoffreykwan geoffreykwan merged commit 58e2f9f into develop Jul 1, 2024
0 of 3 checks passed
@geoffreykwan geoffreykwan deleted the issue-259-implement-unit-tagging branch July 1, 2024 22:06
@geoffreykwan
Copy link
Member Author

🎉 This issue has been resolved in version 1.2.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

feat(Teacher): Implement unit tagging
3 participants