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

#16271: Fixing that saving workflow fails when using decimal comma (,) #16274

Merged
merged 7 commits into from
Jun 13, 2024

Conversation

microposmp
Copy link
Contributor

Fixes: #16271

@@ -475,8 +476,8 @@ public async Task<IActionResult> Edit(WorkflowTypeUpdateModel model)
foreach (var activityState in activities)
{
var activity = currentActivities[activityState["id"].ToString()];
activity.X = (int)Convert.ToDecimal(activityState["x"].ToString());
activity.Y = (int)Convert.ToDecimal(activityState["y"].ToString());
activity.X = (int)Convert.ToDecimal(activityState["x"].ToString(), CultureInfo.InvariantCulture);
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure why we need a decimal while at the end we convert the values to integers.

/cc @hyzx86

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure, maybe the X, Y attributes are defined as Integer so they need a layer of conversion, I wouldn't mind changing them directly to Decimal.

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 think it's better to keep X, Y attributes as int. Most browsers truncate the fractional part if the position is set with decimal numbers (10.75px -> 10px).

I've made a version where the state is returned from the client without the fractional part. It uses "Math.trunc" that is only available from javascript version es6/es2015.

Copy link
Member

@Piedone Piedone left a comment

Choose a reason for hiding this comment

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

@BenedekFarkas BenedekFarkas changed the title Workflow save #16271: Fixing that saving workflow fails when using decimal comma (,) Jun 13, 2024
Copy link
Contributor

This pull request has merge conflicts. Please resolve those before requesting a review.

# Conflicts:
#	src/docs/resources/libraries/README.md
Copy link
Member

@Piedone Piedone left a comment

Choose a reason for hiding this comment

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

This works fine too. If anybody else would like to check this, please do, or I'll merge it tomorrow.

@sebastienros sebastienros merged commit 2a59841 into OrchardCMS:main Jun 13, 2024
20 checks passed
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.

Saving workflow fails when using decimal comma (,)
7 participants