fix: remove TestSql.cs that caused build errors
This commit is contained in:
@@ -1,31 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
|
||||||
using Predictalytics.Infrastructure.Data;
|
|
||||||
using Predictalytics.Infrastructure.Data.Repositories;
|
|
||||||
using System;
|
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
var services = new ServiceCollection();
|
|
||||||
var dbVersion = new MySqlServerVersion(new Version(8, 0, 36));
|
|
||||||
services.AddDbContext<AppDbContext>(o => o.UseMySql("Server=localhost;Database=test;User=root;Password=test", dbVersion));
|
|
||||||
services.AddScoped<ITraderRepository, TraderRepository>();
|
|
||||||
var sp = services.BuildServiceProvider();
|
|
||||||
using var scope = sp.CreateScope();
|
|
||||||
var db = scope.ServiceProvider.GetRequiredService<AppDbContext>();
|
|
||||||
|
|
||||||
var priorityCutoff = DateTime.UtcNow.AddHours(-1);
|
|
||||||
var normalCutoff = DateTime.UtcNow.AddHours(-12);
|
|
||||||
|
|
||||||
var query = db.Traders
|
|
||||||
.Include(t => t.WatchlistEntries)
|
|
||||||
.Where(t => t.LastTradesUpdatedAt == null ||
|
|
||||||
(!t.IsInitialImportComplete) ||
|
|
||||||
((!t.IsAutoDiscovered || t.WatchlistEntries.Any()) && t.LastTradesUpdatedAt < priorityCutoff) ||
|
|
||||||
(t.IsAutoDiscovered && t.LastTradesUpdatedAt < normalCutoff))
|
|
||||||
.OrderBy(t => t.IsAutoDiscovered)
|
|
||||||
.ThenByDescending(t => t.WatchlistEntries.Any())
|
|
||||||
.ThenBy(t => t.IsInitialImportComplete)
|
|
||||||
.ThenBy(t => t.LastTradesUpdatedAt ?? DateTime.MinValue)
|
|
||||||
.Take(20);
|
|
||||||
|
|
||||||
Console.WriteLine(query.ToQueryString());
|
|
||||||
Reference in New Issue
Block a user