fix: Crowdin proofreader cancelling event is not well triggered - Meeds-io/meeds#2655#64
Open
sergeByishimo wants to merge 2 commits intoMeeds-io:developfrom
Open
fix: Crowdin proofreader cancelling event is not well triggered - Meeds-io/meeds#2655#64sergeByishimo wants to merge 2 commits intoMeeds-io:developfrom
sergeByishimo wants to merge 2 commits intoMeeds-io:developfrom
Conversation
…ds-io/meeds#2655 Currently while cancelling points are removed for the translator, but not for the approver but it should. This pull request intends to make sure that the points are removed for the translator as well
AzmiTouil
reviewed
Jan 28, 2025
Comment on lines
96
to
118
| if (trigger.equals(SUGGESTION_DISAPPROVED_TRIGGER)) { | ||
| // Retrieve who made that approval from the database | ||
|
|
||
| List<RealizationDTO> realizations = realizationService. | ||
| findRealizationsByObjectIdAndObjectType(objectId, TRANSLATION); | ||
|
|
||
| if ( ! realizations.isEmpty()) { | ||
| String approvalUsername = realizations.get(0).getEarnerId(); | ||
|
|
||
| eventList.add(new Event(APPROVE_SUGGESTION_EVENT_NAME, | ||
| approvalUsername, | ||
| approvalUsername, | ||
| objectId, | ||
| TRANSLATION, | ||
| getProjectId(payload), | ||
| extractSubItem(payload, TRANSLATION, TARGET_LANGUAGE, ID), | ||
| extractSubItem(payload, TRANSLATION, PROVIDER) == null, | ||
| extractSubItem(payload, TRANSLATION, STRING, FILE, DIRECTORY_ID), | ||
| true, | ||
| countWords(extractSubItem(payload, TRANSLATION, STRING, TEXT)))); | ||
| } else { | ||
| LOG.warn("No realization found while cancelling translation with id: " + objectId); | ||
| } |
Contributor
There was a problem hiding this comment.
- We also need to verify the realization event name to check if it is
approveSuggestion. FYI, It might also besuggestionAdded, as both share the same objectId and objectType. - There's no need to log a trace when the realization is not found.
- Please ensure the code is formatted properly.
Contributor
Author
There was a problem hiding this comment.
I added a new object type specifically for approvals. Although I'm having trouble identifing where exactly this jacoco-maven build error is coming from
Contributor
There was a problem hiding this comment.
The build failure is caused by a code coverage rule violation: [WARNING] Rule violated for bundle gamification-crowdin-service: instructions covered ratio is 0.26, but expected minimum is 0.27
You need to increase test coverage by adding new unit tests to cover this use case.
I used a new object type for approvals
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently while cancelling points are removed for the translator, but not for the approver but it should.
This pull request intends to make sure that the points are removed for the translator as well by getting
the previous approval user from the database.