This commit is contained in:
2018-12-10 22:31:42 +00:00
parent b6731ff4d9
commit ec1ee7a51e
4 changed files with 21 additions and 5 deletions

View File

@@ -5,6 +5,7 @@ using System.Text;
using Newtonsoft.Json.Linq;
using System.Linq;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
namespace AyaNova.Biz
{
@@ -280,6 +281,9 @@ namespace AyaNova.Biz
//So this is the core date time to work off of
DateTime RelativeToday = DateTime.Today;
ILogger log = AyaNova.Util.ApplicationLogging.CreateLogger("FilterSqlCriteriaBuilder::DataFilterToColumnCriteria");
log.LogInformation("RelativeToday (before adjustment):");
log.LogInformation(RelativeToday.ToString());
if (sValue.StartsWith("{[") && sValue.EndsWith("]}"))
@@ -288,7 +292,15 @@ namespace AyaNova.Biz
//Fetch useroptions object and relative time offset
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();
RelativeToday=RelativeToday.AddHours((double)u.tz);
RelativeToday = RelativeToday.AddHours((double)u.tz);
//TESTING:
//LOG THE CRIT AND QUERY
// ILogger log = AyaNova.Util.ApplicationLogging.CreateLogger("FilterSqlCriteriaBuilder::DataFilterToColumnCriteria");
log.LogInformation("RelativeToday (adjusted):");
log.LogInformation(RelativeToday.ToString());
log.LogInformation("Offset used:");
log.LogInformation(u.tz.ToString());
#region Build criteria for date RANGE TOKEN specified
//Used as the basis point
@@ -421,7 +433,7 @@ namespace AyaNova.Biz
case FilterSpecialToken.NextMonth:
//start with the first day of this month
dtAfter = new DateTime(RelativeToday.Year, RelativeToday.Month, 1, 00, 00, 00);
dtAfter = new DateTime(RelativeToday.Year, RelativeToday.Month, 1, RelativeToday.Hour, RelativeToday.Minute, 00);
//Add a Month
dtAfter = dtAfter.AddMonths(1);
@@ -430,7 +442,9 @@ namespace AyaNova.Biz
//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(sColumn, sb, dtAfter, dtBefore);
break;
case FilterSpecialToken.FourteenDayWindow:

View File

@@ -189,6 +189,7 @@ namespace AyaNova.Biz
q = q + FilterSqlCriteriaBuilder.DataFilterToSQLCriteria(TheFilter, WidgetBiz.FilterOptions(), UserId);
//TESTING:
//TODO: remove this from production build
//LOG THE CRIT AND QUERY
ILogger log = AyaNova.Util.ApplicationLogging.CreateLogger("WidgetBiz::GetManyAsync");
log.LogInformation("Filter criteria:");

View File

@@ -1584,6 +1584,7 @@ namespace raven_integration
long DataFilterId = a.ObjectResponse["data"]["id"].Value<long>();
//NOW FETCH WIDGET LIST WITH FILTER
//SELECT *, xmin FROM AWIDGET where name Like 'DateTokenNextMonthFilterWorks%' AND startdate >'2019-01-01T15:59:59.0000000Z' AND startdate <'2019-02-01T16:00:00.0000000Z'
a = await Util.GetAsync($"Widget/listwidgets?Offset=0&Limit=999&DataFilterId={DataFilterId.ToString()}", await Util.GetTokenAsync("manager", "l3tm3in"));
Util.ValidateDataReturnResponseOk(a);
Util.ValidateHTTPStatusCode(a, 200);

View File

@@ -12,8 +12,8 @@ namespace raven_integration
{
private static HttpClient client { get; } = new HttpClient();
private static string API_BASE_URL = "http://localhost:7575/api/v8.0/";
// private static string API_BASE_URL = "https://test.helloayanova.com/api/v8.0/";
// private static string API_BASE_URL = "http://localhost:7575/api/v8.0/";
private static string API_BASE_URL = "https://test.helloayanova.com/api/v8.0/";
public static string TEST_DATA_FOLDER = @"..\..\..\testdata\";