Skip to content

Comments

fix: Crowdin proofreader cancelling event is not well triggered - Meeds-io/meeds#2655#64

Open
sergeByishimo wants to merge 2 commits intoMeeds-io:developfrom
sergeByishimo:fix-crowdin-approval-3
Open

fix: Crowdin proofreader cancelling event is not well triggered - Meeds-io/meeds#2655#64
sergeByishimo wants to merge 2 commits intoMeeds-io:developfrom
sergeByishimo:fix-crowdin-approval-3

Conversation

@sergeByishimo
Copy link
Contributor

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.

…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
@plamarque plamarque requested a review from AzmiTouil January 28, 2025 08:32
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);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

  • We also need to verify the realization event name to check if it is approveSuggestion. FYI, It might also be suggestionAdded, 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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

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

Copy link
Contributor

Choose a reason for hiding this comment

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

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
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.

2 participants