Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion project-demos/ivy-ask-statistics/Apps/DashboardApp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,7 @@ static void FillMetrics(
}

private static DashboardData BuildDashboardData(
List<TestResultEntity> results,
List<TestRunResultEntity> results,
double? prevAnswerRate,
int? prevAvgMs,
TestRunEntity? run = null)
Expand Down
2 changes: 1 addition & 1 deletion project-demos/ivy-ask-statistics/Apps/QuestionEditSheet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ private record EditRequest
}

/// <summary>
/// Question row plus optional response preview: either the specific <see cref="TestResultEntity"/> row
/// Question row plus optional response preview: either the specific <see cref="TestRunResultEntity"/> row
/// (when opened from a run results table) or the latest answer across all runs (elsewhere).
/// </summary>
private sealed record QuestionEditPayload(
Expand Down
4 changes: 2 additions & 2 deletions project-demos/ivy-ask-statistics/Apps/RunApp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -698,13 +698,13 @@ private static async Task<bool> PersistNewRunAsync(
};
ctx.TestRuns.Add(run);

var rows = new List<TestResultEntity>(ordered.Count);
var rows = new List<TestRunResultEntity>(ordered.Count);
foreach (var result in ordered)
{
if (!Guid.TryParse(result.Question.Id, out var questionId))
throw new InvalidOperationException($"Invalid question id: {result.Question.Id}");

rows.Add(new TestResultEntity
rows.Add(new TestRunResultEntity
{
TestRunId = run.Id,
QuestionId = questionId,
Expand Down
4 changes: 2 additions & 2 deletions project-demos/ivy-ask-statistics/Connections/AppDbContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ public class AppDbContext(DbContextOptions<AppDbContext> options) : DbContext(op
{
public DbSet<QuestionEntity> Questions { get; set; }
public DbSet<TestRunEntity> TestRuns { get; set; }
public DbSet<TestResultEntity> TestResults { get; set; }
public DbSet<TestRunResultEntity> TestResults { get; set; }

protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<TestResultEntity>(e =>
modelBuilder.Entity<TestRunResultEntity>(e =>
{
e.HasOne(r => r.TestRun)
.WithMany(tr => tr.Results)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ public class QuestionEntity

public DateTime CreatedAt { get; set; } = DateTime.UtcNow;

public List<TestResultEntity> TestResults { get; set; } = [];
public List<TestRunResultEntity> TestResults { get; set; } = [];
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ public class TestRunEntity
public DateTime StartedAt { get; set; } = DateTime.UtcNow;
public DateTime? CompletedAt { get; set; }

public List<TestResultEntity> Results { get; set; } = [];
public List<TestRunResultEntity> Results { get; set; } = [];
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace IvyAskStatistics.Connections;

[Table("ivy_ask_test_results")]
public class TestRunResultEntity
{
public Guid Id { get; set; } = Guid.NewGuid();

public Guid TestRunId { get; set; }
public TestRunEntity TestRun { get; set; } = null!;

public Guid QuestionId { get; set; }
public QuestionEntity Question { get; set; } = null!;

public string ResponseText { get; set; } = "";
public int ResponseTimeMs { get; set; }
public bool IsSuccess { get; set; }
public int HttpStatus { get; set; }

[MaxLength(500)]
public string? ErrorMessage { get; set; }

public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
}
Loading