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

Adds missing support for lexicographical comparison for numeric operators #15

Closed
wants to merge 2 commits into from

Conversation

sarensw
Copy link

@sarensw sarensw commented Mar 13, 2020

This pull request adds missing support for lexicographical comparison for numeric operators. Operators supported are <, >, <=, >=.
This is especially useful for comparison of dates, for example.

Fixes #14

@sarensw
Copy link
Author

sarensw commented Mar 13, 2020

@yavuztor the build is failing with the following error message "Error signing output with

public key from file '../../signingKey.snk'

I had the same issue on my local dev machine and resolved it by removing this link in the AssemblyInfo.cs file. I'm not sure why this is needed.

@yavuztor
Copy link
Owner

@sarensw , it took me a while to get to this, sorry for that. When I added the strong naming, I added the private key, which has caused the build failure you have experienced. I pushed the change that fixes the issue.

Copy link
Owner

@yavuztor yavuztor left a comment

Choose a reason for hiding this comment

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

The fix is good, but needs some reorganization.

var allText = values.All(a => a.Type == JTokenType.String);
if (allText)
{
var valuesText = args.Select(a => a == null ? "" : p.Apply(a, data).ToString()).ToArray();
Copy link
Owner

Choose a reason for hiding this comment

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

the values are already generated. There is no need to re-apply the evaluations. You can use the values like var textValues = values.Cast<strirng>().ToArray();


// all values text?
var allText = values.All(a => a.Type == JTokenType.String);
if (allText)
Copy link
Owner

Choose a reason for hiding this comment

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

With this change, this method handles two cases: text and double. We can extract each of those cases into a method and then simplify this method to something like:

return allText ? CheckCriteria(values.Cast<string>()) : CheckCriteria(values.Cast<double>());

@yavuztor
Copy link
Owner

yavuztor commented Oct 7, 2020

Closing this because of inactivity.

@yavuztor yavuztor closed this Oct 7, 2020
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.

Support for lexicographical comparison for numeric operators
2 participants