case 4690 - data-list date filters: >= and < from the start of the minute, != excludes the whole minute; null check first
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -21,6 +21,11 @@ namespace AyaNova.DataList
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
DataListFieldDefinition DataListField = objectFieldsList.FirstOrDefault(z => z.FieldKey == f.Column);
|
||||
//checked before first use and in all builds (was DEBUG only and after use, so an unknown column was a NullReferenceException)
|
||||
if (DataListField == null)
|
||||
{
|
||||
throw new System.ArgumentException($"DataListSqlFilterCriteriaBuilder: filter column {f.Column} is not a field of this data list");
|
||||
}
|
||||
var dataType = DataListField.UiFieldDataType;
|
||||
|
||||
//No filtering on custom fields!
|
||||
@@ -28,13 +33,6 @@ namespace AyaNova.DataList
|
||||
{
|
||||
continue;
|
||||
}
|
||||
#if (DEBUG)
|
||||
//Developers little helper
|
||||
if (DataListField == null)
|
||||
{
|
||||
throw new System.ArgumentNullException($"DEV ERROR in DataListSqlFilterCriteriaBuilder.cs: field {f.Column} specified in template was NOT found in ObjectFields list");
|
||||
}
|
||||
#endif
|
||||
|
||||
//Iterate filter items building this WHERE segment
|
||||
bool ThisIsTheFirstFilterItemForThisColumn = true;
|
||||
@@ -794,13 +792,15 @@ namespace AyaNova.DataList
|
||||
break;
|
||||
|
||||
case DataListFilterComparisonOperator.GreaterThanOrEqualTo:
|
||||
//from the start of the selected minute (MaxSeconds here dropped everything in that minute but its last millisecond)
|
||||
sb.Append(">='");
|
||||
sb.Append(sDateValueWithMaxSeconds);
|
||||
sb.Append(sDateValueWithZeroSeconds);
|
||||
sb.Append("'");
|
||||
break;
|
||||
case DataListFilterComparisonOperator.LessThan:
|
||||
//before the start of the selected minute (MaxSeconds here included almost all of that minute)
|
||||
sb.Append("<'");
|
||||
sb.Append(sDateValueWithMaxSeconds);
|
||||
sb.Append(sDateValueWithZeroSeconds);
|
||||
sb.Append("'");
|
||||
break;
|
||||
case DataListFilterComparisonOperator.LessThanOrEqualTo:
|
||||
@@ -810,8 +810,9 @@ namespace AyaNova.DataList
|
||||
break;
|
||||
|
||||
case DataListFilterComparisonOperator.NotEqual:
|
||||
//outside the whole selected minute, the opposite of Equality above (was < MaxSeconds, which excluded only the last millisecond)
|
||||
sb.Append("<'");
|
||||
sb.Append(sDateValueWithMaxSeconds);
|
||||
sb.Append(sDateValueWithZeroSeconds);
|
||||
sb.Append("' OR ");
|
||||
sb.Append(SqlColumnNameToFilter);
|
||||
sb.Append(" ");
|
||||
|
||||
Reference in New Issue
Block a user