From 83cb6edceecb5bf2dc97d62ffa7794cbed540a4d Mon Sep 17 00:00:00 2001
From: Jonathan Idland Olsnes <73334350+Jonathanio123@users.noreply.github.com>
Date: Mon, 16 Sep 2024 14:42:07 +0200
Subject: [PATCH] fix: Use double instead of int for FTE
---
.../ApiPersonnelMoreThan100PercentFTE.cs | 2 +-
...916124003_FTE_FromInt_ToDouble.Designer.cs | 176 ++++++++++++++++++
.../20240916124003_FTE_FromInt_ToDouble.cs | 22 +++
.../SummaryDbContextModelSnapshot.cs | 4 +-
.../Database/Models/DbWeeklySummaryReport.cs | 2 +-
.../Domain/Models/QueryWeeklySummaryReport.cs | 2 +-
6 files changed, 203 insertions(+), 5 deletions(-)
create mode 100644 src/Fusion.Summary.Api/Database/Migrations/20240916124003_FTE_FromInt_ToDouble.Designer.cs
create mode 100644 src/Fusion.Summary.Api/Database/Migrations/20240916124003_FTE_FromInt_ToDouble.cs
diff --git a/src/Fusion.Summary.Api/Controllers/ApiModels/ApiPersonnelMoreThan100PercentFTE.cs b/src/Fusion.Summary.Api/Controllers/ApiModels/ApiPersonnelMoreThan100PercentFTE.cs
index 46669883c..77ee2a00b 100644
--- a/src/Fusion.Summary.Api/Controllers/ApiModels/ApiPersonnelMoreThan100PercentFTE.cs
+++ b/src/Fusion.Summary.Api/Controllers/ApiModels/ApiPersonnelMoreThan100PercentFTE.cs
@@ -3,5 +3,5 @@ namespace Fusion.Summary.Api.Controllers.ApiModels;
public class ApiPersonnelMoreThan100PercentFTE
{
public required string FullName { get; set; }
- public required int FTE { get; set; }
+ public required double FTE { get; set; }
}
\ No newline at end of file
diff --git a/src/Fusion.Summary.Api/Database/Migrations/20240916124003_FTE_FromInt_ToDouble.Designer.cs b/src/Fusion.Summary.Api/Database/Migrations/20240916124003_FTE_FromInt_ToDouble.Designer.cs
new file mode 100644
index 000000000..44514b6dd
--- /dev/null
+++ b/src/Fusion.Summary.Api/Database/Migrations/20240916124003_FTE_FromInt_ToDouble.Designer.cs
@@ -0,0 +1,176 @@
+//
+using System;
+using Fusion.Summary.Api.Database;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+
+#nullable disable
+
+namespace Fusion.Summary.Api.Database.Migrations
+{
+ [DbContext(typeof(SummaryDbContext))]
+ [Migration("20240916124003_FTE_FromInt_ToDouble")]
+ partial class FTE_FromInt_ToDouble
+ {
+ ///
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("ProductVersion", "8.0.6")
+ .HasAnnotation("Relational:MaxIdentifierLength", 128);
+
+ SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
+
+ modelBuilder.Entity("Fusion.Summary.Api.Database.Models.DbDepartment", b =>
+ {
+ b.Property("DepartmentSapId")
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("DelegateResourceOwnersAzureUniqueId")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("FullDepartmentName")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("ResourceOwnersAzureUniqueId")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("DepartmentSapId");
+
+ b.ToTable("Departments", (string)null);
+ });
+
+ modelBuilder.Entity("Fusion.Summary.Api.Database.Models.DbWeeklySummaryReport", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uniqueidentifier");
+
+ b.Property("AllocationChangesAwaitingTaskOwnerAction")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("AverageTimeToHandleRequests")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("CapacityInUse")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("DepartmentSapId")
+ .IsRequired()
+ .HasColumnType("nvarchar(450)");
+
+ b.Property("NumberOfOpenRequests")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("NumberOfPersonnel")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("NumberOfRequestsLastPeriod")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("NumberOfRequestsStartingInLessThanThreeMonths")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("NumberOfRequestsStartingInMoreThanThreeMonths")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.Property("Period")
+ .HasColumnType("datetime2");
+
+ b.Property("ProjectChangesAffectingNextThreeMonths")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("DepartmentSapId", "Period")
+ .IsUnique();
+
+ b.ToTable("WeeklySummaryReports", (string)null);
+ });
+
+ modelBuilder.Entity("Fusion.Summary.Api.Database.Models.DbWeeklySummaryReport", b =>
+ {
+ b.HasOne("Fusion.Summary.Api.Database.Models.DbDepartment", "Department")
+ .WithMany()
+ .HasForeignKey("DepartmentSapId")
+ .OnDelete(DeleteBehavior.Restrict)
+ .IsRequired();
+
+ b.OwnsMany("Fusion.Summary.Api.Database.Models.DbEndingPosition", "PositionsEnding", b1 =>
+ {
+ b1.Property("DbWeeklySummaryReportId")
+ .HasColumnType("uniqueidentifier");
+
+ b1.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ b1.Property("EndDate")
+ .HasColumnType("datetime2");
+
+ b1.Property("FullName")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b1.HasKey("DbWeeklySummaryReportId", "Id");
+
+ b1.ToTable("WeeklySummaryReports");
+
+ b1.ToJson("PositionsEnding");
+
+ b1.WithOwner()
+ .HasForeignKey("DbWeeklySummaryReportId");
+ });
+
+ b.OwnsMany("Fusion.Summary.Api.Database.Models.DbPersonnelMoreThan100PercentFTE", "PersonnelMoreThan100PercentFTE", b1 =>
+ {
+ b1.Property("DbWeeklySummaryReportId")
+ .HasColumnType("uniqueidentifier");
+
+ b1.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ b1.Property("FTE")
+ .HasColumnType("float");
+
+ b1.Property("FullName")
+ .IsRequired()
+ .HasColumnType("nvarchar(max)");
+
+ b1.HasKey("DbWeeklySummaryReportId", "Id");
+
+ b1.ToTable("WeeklySummaryReports");
+
+ b1.ToJson("PersonnelMoreThan100PercentFTE");
+
+ b1.WithOwner()
+ .HasForeignKey("DbWeeklySummaryReportId");
+ });
+
+ b.Navigation("Department");
+
+ b.Navigation("PersonnelMoreThan100PercentFTE");
+
+ b.Navigation("PositionsEnding");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/src/Fusion.Summary.Api/Database/Migrations/20240916124003_FTE_FromInt_ToDouble.cs b/src/Fusion.Summary.Api/Database/Migrations/20240916124003_FTE_FromInt_ToDouble.cs
new file mode 100644
index 000000000..70125c672
--- /dev/null
+++ b/src/Fusion.Summary.Api/Database/Migrations/20240916124003_FTE_FromInt_ToDouble.cs
@@ -0,0 +1,22 @@
+using Microsoft.EntityFrameworkCore.Migrations;
+
+#nullable disable
+
+namespace Fusion.Summary.Api.Database.Migrations
+{
+ ///
+ public partial class FTE_FromInt_ToDouble : Migration
+ {
+ ///
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+
+ }
+
+ ///
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+
+ }
+ }
+}
diff --git a/src/Fusion.Summary.Api/Database/Migrations/SummaryDbContextModelSnapshot.cs b/src/Fusion.Summary.Api/Database/Migrations/SummaryDbContextModelSnapshot.cs
index 915d5b7ff..4f9c9f4d7 100644
--- a/src/Fusion.Summary.Api/Database/Migrations/SummaryDbContextModelSnapshot.cs
+++ b/src/Fusion.Summary.Api/Database/Migrations/SummaryDbContextModelSnapshot.cs
@@ -144,8 +144,8 @@ protected override void BuildModel(ModelBuilder modelBuilder)
.ValueGeneratedOnAdd()
.HasColumnType("int");
- b1.Property("FTE")
- .HasColumnType("int");
+ b1.Property("FTE")
+ .HasColumnType("float");
b1.Property("FullName")
.IsRequired()
diff --git a/src/Fusion.Summary.Api/Database/Models/DbWeeklySummaryReport.cs b/src/Fusion.Summary.Api/Database/Models/DbWeeklySummaryReport.cs
index 7f95d1ef2..7b9715977 100644
--- a/src/Fusion.Summary.Api/Database/Models/DbWeeklySummaryReport.cs
+++ b/src/Fusion.Summary.Api/Database/Models/DbWeeklySummaryReport.cs
@@ -55,7 +55,7 @@ internal static void OnModelCreating(ModelBuilder modelBuilder)
public class DbPersonnelMoreThan100PercentFTE
{
public required string FullName { get; set; }
- public required int FTE { get; set; }
+ public required double FTE { get; set; }
}
public class DbEndingPosition
diff --git a/src/Fusion.Summary.Api/Domain/Models/QueryWeeklySummaryReport.cs b/src/Fusion.Summary.Api/Domain/Models/QueryWeeklySummaryReport.cs
index 44f936a9b..81c808abc 100644
--- a/src/Fusion.Summary.Api/Domain/Models/QueryWeeklySummaryReport.cs
+++ b/src/Fusion.Summary.Api/Domain/Models/QueryWeeklySummaryReport.cs
@@ -95,7 +95,7 @@ public DbWeeklySummaryReport ToDbSummaryReport()
public class PersonnelMoreThan100PercentFTE
{
public required string FullName { get; set; }
- public required int FTE { get; set; }
+ public required double FTE { get; set; }
}
public class EndingPosition