This commit is contained in:
2020-02-03 18:50:56 +00:00
parent a8a892d556
commit dbde4b68fd
2 changed files with 20 additions and 22 deletions

View File

@@ -13,7 +13,6 @@ namespace AyaNova.DataList
{
public static string DataFilterToSQLCriteria(List<AyaDataListFieldDefinition> objectFieldsList, AyaNova.Models.DataListFilter dataFilter, List<AyaDataListFieldDefinition> objectFields, long userId)
{
//BUGBUG: is using field property name not sql value column or whatever it's supposed to be
if (string.IsNullOrWhiteSpace(dataFilter.Filter))
{
@@ -305,25 +304,11 @@ namespace AyaNova.DataList
if (sValue.StartsWith("{[") && sValue.EndsWith("]}"))
{
//BUGBUG: Ok, here's the issue:
//This test is run when my local time is winter time or "standard time" which is -8utc
//this test creates a future record for April which will be in DST or "daylight saving time" which is -7utc because it uses a library method to convert to universal time
//which takes into account the date.
//In other words, test code is using conversions based on DST PST effective of the created date falls on
//At the server it's just blindly doing -8 because the user settings are at -8
//This means the server is filtering an april date using the forced -8 but the client is using the actual -7 so they are an hour out
//Fixes:
//Is it an issue? User is normally going to select specific dates and times regardless of time zone so this client code is actually a bit off when you think of it that way
//So test client should take into account user options setting rather than local date setting?
//Or, should server instead of having hard coded offset just have user's time zone and it in turn does the calcs properly
//so local users doesn't select an offset but rather a time zone and let .net handle all the conversions
//In future there won't be a daylight saving time in pacific time zone likely
//Need to adjust RelativeToday to users time frame
//Fetch useroptions object and relative time offset
//See servers spec doc core-locale-currency-numbers-time-and-dates.txt for details about why this is necessary to be done this way
AyaNova.Models.AyContext ct = AyaNova.Util.ServiceProviderProvider.DBContext;
var u = ct.User.AsNoTracking().Where(a => a.Id == userId).Select(m => new { tz = m.UserOptions.TimeZoneOffset }).First();
@@ -474,9 +459,6 @@ namespace AyaNova.DataList
break;
case DataListFilterSpecialToken.NextMonth:
//BUGBUG?
//SERVER thinks midnight UTC is 7am our time on January 1st 2020
//TEST thinks midnight UTC is 8am our time on January 1st 2020
//start with the first day of this month
dtAfter = new DateTime(RelativeToday.Year, RelativeToday.Month, 1, RelativeToday.Hour, RelativeToday.Minute, 00);
//Add a Month
@@ -487,8 +469,6 @@ namespace AyaNova.DataList
//case 1155
dtAfter = dtAfter.AddSeconds(-1);
//TODO: REMOVE THIS TESTING
// log.LogInformation($"NEXT MONTH TOKEN BUILDER IMMEDIATELY BEFORE BUILDING FRAGMENT: BEFORE={dtBefore.ToString()} AND AFTER={dtAfter.ToString()}");
BuildBetweenTwoDatesFragment(SqlColumnNameToFilter, sb, dtAfter, dtBefore);
break;
case DataListFilterSpecialToken.FourteenDayWindow: