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

FEATURE: change status on unsolve & fix assign changes #289

Merged
merged 4 commits into from May 8, 2024

Conversation

Grubba27
Copy link
Contributor

@Grubba27 Grubba27 commented May 7, 2024

When a topic is unsolved, it should have an option, defined in the settings, to change its status to that state.

Fix assign changes when a topic was solved; previously, it changed the assignee.

When a topic is unsolved, it should have an option,
defined in the settings, to change its status to that state.

Fix assign changes when a topic was solved, previously it was
changing the assignee.
Update tests to verify that the change status on solve feature is working as expected.
Change the implementation to loop throught the topic assignments and update the status.
plugin.rb Outdated
post.acting_user,
status: SiteSetting.assignment_status_on_solve,
)
assignements = Assignment.where(topic: post.topic)
Copy link
Contributor

Choose a reason for hiding this comment

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

assignements -> assignments ;)

Copy link
Contributor

Choose a reason for hiding this comment

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

You can do

assignments = Assignment.includes(:target).where(topic: post.topic)

which will preload the target to avoid an N+1 query thennnnn we avoid the whole switch statement and do

Assigner.new(assignment.target, assigned_user).assign(
          assigned_user,
          status: SiteSetting.assignment_status_on_solve,
        )

@Grubba27 Grubba27 marked this pull request as ready for review May 8, 2024 17:57
@Grubba27 Grubba27 merged commit 9db72ef into main May 8, 2024
4 checks passed
@Grubba27 Grubba27 deleted the feature/add-assign-on-unsolve branch May 8, 2024 18:17
@Grubba27 Grubba27 restored the feature/add-assign-on-unsolve branch May 20, 2024 17:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants