Skip to content

Fix Resurrect Achievement Items#2938

Open
dlglin wants to merge 4 commits intoopenwebwork:WeBWorK-2.21from
dlglin:fix-resurrect
Open

Fix Resurrect Achievement Items#2938
dlglin wants to merge 4 commits intoopenwebwork:WeBWorK-2.21from
dlglin:fix-resurrect

Conversation

@dlglin
Copy link
Copy Markdown
Member

@dlglin dlglin commented Mar 26, 2026

This fixes a couple of issues with the resurrect achievement items in the case where reduced scoring is enabled:

  1. Checks whether reduced scoring is enabled rather than checking for the existence of a reduced scoring date.
  2. Fixes the messages and the logic when using the item on a set that is in the reduced scoring period. See Error in resurrect achievement items when reduced scoring is enabled #2907 for the discussion of how this is implemented.

This fixes #2907.

@dlglin dlglin changed the base branch from develop to WeBWorK-2.21 March 31, 2026 20:52
Comment on lines +85 to 99
if ($set->enable_reduced_scoring && ($set->reduced_scoring_date != $set->due_date)) {
return $c->maketext(
'This assignment has been reopened and is due on [_1]. After that date any work '
. 'completed will count for [_2]% of its value until [_3]. ',
$c->formatDateTime($set->reduced_scoring_date, $c->ce->{studentDateDisplayFormat}),
$c->ce->{pg}{ansEvalDefaults}{reducedScoringValue} * 100,
$c->formatDateTime($set->due_date, $c->ce->{studentDateDisplayFormat})
) . $rerandomizeMessage;
} else {
return $c->maketext(
'This assignment has been reopened and will now close on [_1]. ',
$c->formatDateTime($set->due_date, $c->ce->{studentDateDisplayFormat})
) . $rerandomizeMessage;
}
}
Copy link
Copy Markdown
Contributor

@somiaj somiaj Apr 1, 2026

Choose a reason for hiding this comment

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

$rerandomizeMessage should also be a positional argument inside of the maketext call.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Unsure if that gets tricky or there should be a conditional to check if it should be added or not so the translated strings don't have extra space in them in the case rerandomizeMessage is empty.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

$rerandomizeMessage is the result of a maketext call, so that string will already be translated. I don't see how having it as a positional argument is necessary.

Is it a problem to have an extra space at the end of a string to be translated?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

My understanding is not all languages are right to left, so just appending the string to the end may not be appropriate for some translations.

In terms of the html, an extra space won't matter, but what happens if a translation doesn't understand that space is important and leaves it off. Putting the translated string as a positional argument inside the maketext call makes the use of the space clearer and allows positioning the statement in the string appropriately for the translation.

There are various places thought out the code that a string is translated and then added as a positional argument in future translations to join things together. I think this should probably do the same. I think the space thing is very minor and probably won't matter if the positional argument is empty.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Others may have a better knowledge, what you did may be okay, I just feel it isn't. I think a positional argument is better than string concatenation. I'm unsure if there is a better approach to avoid having to write lots of cases like you have been doing in most of this.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It is always best to give as much as possible together for translations. However, generally concatenations of two sentences can be done. Usually the bidirectional algorithm will make it work even for right to left languages. However, the space should be inserted between the translations and not inside of one of them. The translator may not add that space in the translation, and even if they do may not put it in the correct place, not knowing that it is going to be concatenated with another translation.

Perhaps making it a positional argument inside another translation is better though.

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.

3 participants