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

refactor(AnnotationService): Simplify getLatestAnnotation logic #2005

Merged

Conversation

hirokiterashima
Copy link
Member

Changes

This pull request includes several changes to the AnnotationService class in src/assets/wise5/services/annotationService.ts to improve code consistency and simplify the method getLatestAnnotation. Additionally, a small change was made to the VLEComponent class in src/assets/wise5/vle/vle.component.ts. getLatestAnnotation is only called via embedded components that use WISEAPI.

Code Consistency Improvements:

  • Removed the redundant 'use strict'; directive from annotationService.ts.
  • Corrected the casing of injected services in the constructor of AnnotationService from ConfigService and ProjectService to configService and projectService.
  • Updated method calls to use the corrected service names (configService and projectService) throughout AnnotationService. [1] [2] [3] [4]

Method Simplification:

  • Simplified the getLatestAnnotation method by removing nested conditionals and using a more concise iteration and matching approach.

Minor Change:

  • Simplified the getLatestAnnotationForComponent method in VLEComponent by directly passing parameters to the getLatestAnnotation method of annotationService.

Test

  • VLE loads and works as before.

@hirokiterashima hirokiterashima added this to the Tech Debt 17 -> 16 milestone Nov 26, 2024
@hirokiterashima hirokiterashima self-assigned this Nov 26, 2024
@hirokiterashima hirokiterashima marked this pull request as ready for review November 26, 2024 17:04
@hirokiterashima hirokiterashima merged commit 03ccec3 into develop Nov 26, 2024
3 of 5 checks passed
@hirokiterashima hirokiterashima deleted the refactor-AnnotationService-getLatestAnnotation branch November 26, 2024 17:16
@hirokiterashima
Copy link
Member Author

🎉 This issue has been resolved in version 5.163.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
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

1 participant