修复课表
This commit is contained in:
@@ -108,6 +108,31 @@ public sealed class MySqlMigrationTests
|
||||
Assert.Contains(ids[1].ToString(), sql, StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void MySql_attendance_device_hash_query_uses_provider_safe_predicates()
|
||||
{
|
||||
using var db = new AppDbContext(CreateMySqlOptions());
|
||||
var deviceHashes = new[] { "device-hash-one", "device-hash-two" };
|
||||
|
||||
var sql = db.AttendanceCheckInAttempts
|
||||
.Where(x =>
|
||||
x.IsSuccessful &&
|
||||
x.CreatedAt >= DateTime.UtcNow.AddHours(-24) &&
|
||||
x.DeviceIdentifierHash != null)
|
||||
.WhereIn(deviceHashes, x => x.DeviceIdentifierHash!)
|
||||
.GroupBy(x => x.DeviceIdentifierHash!)
|
||||
.Select(x => new
|
||||
{
|
||||
DeviceIdentifierHash = x.Key,
|
||||
StudentCount = x.Select(a => a.StudentId).Distinct().Count()
|
||||
})
|
||||
.ToQueryString();
|
||||
|
||||
Assert.Contains(" IN (", sql, StringComparison.OrdinalIgnoreCase);
|
||||
Assert.Contains(deviceHashes[0], sql, StringComparison.Ordinal);
|
||||
Assert.Contains(deviceHashes[1], sql, StringComparison.Ordinal);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void MySql_invigilator_candidate_query_is_translatable_without_uuid_ordering()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user