Commit b0b13225 authored by Andres Käver's avatar Andres Käver
Browse files

duration calculation

parent 10aa6563
Pipeline #822 passed with stages
in 1 minute and 28 seconds
......@@ -29,7 +29,7 @@ namespace BLL.App.DTO
public DateTime RecordedAt { get; set; }
[Display(Name = nameof(Duration), ResourceType = typeof(Resources.BLL.App.DTO.GpsSession))]
public int Duration { get; set; } // in seconds
public double Duration { get; set; } // in seconds
[Display(Name = nameof(Speed), ResourceType = typeof(Resources.BLL.App.DTO.GpsSession))]
public double Speed { get; set; } // in seconds per kilometer
......
......@@ -11,7 +11,7 @@ namespace BLL.App.DTO
public DateTime RecordedAt { get; set; }
public int Duration { get; set; } // in seconds
public double Duration { get; set; } // in seconds
public double Speed { get; set; } // in seconds per kilometer
public double Distance { get; set; } // in meters
public double Climb { get; set; } // total climb in meters
......
......@@ -48,6 +48,9 @@ namespace BLL.App.Services
{
gpsSession.Descent += vertical;
}
gpsSession.Duration = (gpsSession.RecordedAt - lastLocation.RecordedAt).TotalSeconds;
await UOW.GpsSessions.UpdateAsync(gpsSession);
return base.Add(gpsLocation);
......
......@@ -24,7 +24,7 @@ namespace DAL.App.DTO
public DateTime RecordedAt { get; set; }
public int Duration { get; set; } // in seconds
public double Duration { get; set; } // in seconds
public double Speed { get; set; } // in seconds per kilometer
public double Distance { get; set; } // in meters
public double Climb { get; set; } // total climb in meters
......
......@@ -11,7 +11,7 @@ namespace DAL.App.DTO
public DateTime RecordedAt { get; set; }
public int Duration { get; set; } // in seconds
public double Duration { get; set; } // in seconds
public double Speed { get; set; } // in seconds per kilometer
public double Distance { get; set; } // in meters
public double Climb { get; set; } // total climb in meters
......
// <auto-generated />
using System;
using DAL.App.EF;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace DAL.App.EF.Migrations
{
[DbContext(typeof(AppDbContext))]
[Migration("20200509213851_DurationToDouble")]
partial class DurationToDouble
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "3.1.3")
.HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("Domain.App.GpsLocation", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<double>("Accuracy")
.HasColumnType("float");
b.Property<double>("Altitude")
.HasColumnType("float");
b.Property<Guid>("AppUserId")
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("ChangedAt")
.HasColumnType("datetime2");
b.Property<string>("ChangedBy")
.HasColumnType("nvarchar(256)")
.HasMaxLength(256);
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime2");
b.Property<string>("CreatedBy")
.HasColumnType("nvarchar(256)")
.HasMaxLength(256);
b.Property<Guid>("GpsLocationTypeId")
.HasColumnType("uniqueidentifier");
b.Property<Guid>("GpsSessionId")
.HasColumnType("uniqueidentifier");
b.Property<double>("Latitude")
.HasColumnType("float");
b.Property<double>("Longitude")
.HasColumnType("float");
b.Property<DateTime>("RecordedAt")
.HasColumnType("datetime2");
b.Property<Guid?>("TrackPointId")
.HasColumnType("uniqueidentifier");
b.Property<double>("VerticalAccuracy")
.HasColumnType("float");
b.HasKey("Id");
b.HasIndex("AppUserId");
b.HasIndex("CreatedAt");
b.HasIndex("GpsLocationTypeId");
b.HasIndex("GpsSessionId");
b.HasIndex("RecordedAt");
b.HasIndex("TrackPointId");
b.ToTable("GpsLocations");
});
modelBuilder.Entity("Domain.App.GpsLocationType", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("ChangedAt")
.HasColumnType("datetime2");
b.Property<string>("ChangedBy")
.HasColumnType("nvarchar(256)")
.HasMaxLength(256);
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime2");
b.Property<string>("CreatedBy")
.HasColumnType("nvarchar(256)")
.HasMaxLength(256);
b.Property<Guid>("DescriptionId")
.HasColumnType("uniqueidentifier");
b.Property<Guid>("NameId")
.HasColumnType("uniqueidentifier");
b.HasKey("Id");
b.HasIndex("DescriptionId");
b.HasIndex("NameId");
b.ToTable("GpsLocationTypes");
});
modelBuilder.Entity("Domain.App.GpsSession", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<Guid>("AppUserId")
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("ChangedAt")
.HasColumnType("datetime2");
b.Property<string>("ChangedBy")
.HasColumnType("nvarchar(256)")
.HasMaxLength(256);
b.Property<double>("Climb")
.HasColumnType("float");
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime2");
b.Property<string>("CreatedBy")
.HasColumnType("nvarchar(256)")
.HasMaxLength(256);
b.Property<double>("Descent")
.HasColumnType("float");
b.Property<string>("Description")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasMaxLength(4096);
b.Property<double>("Distance")
.HasColumnType("float");
b.Property<double>("Duration")
.HasColumnType("float");
b.Property<Guid>("GpsSessionTypeId")
.HasColumnType("uniqueidentifier");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("nvarchar(256)")
.HasMaxLength(256);
b.Property<double>("PaceMax")
.HasColumnType("float");
b.Property<double>("PaceMin")
.HasColumnType("float");
b.Property<DateTime>("RecordedAt")
.HasColumnType("datetime2");
b.Property<double>("Speed")
.HasColumnType("float");
b.HasKey("Id");
b.HasIndex("AppUserId");
b.HasIndex("CreatedAt");
b.HasIndex("GpsSessionTypeId");
b.HasIndex("RecordedAt");
b.ToTable("GpsSessions");
});
modelBuilder.Entity("Domain.App.GpsSessionType", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("ChangedAt")
.HasColumnType("datetime2");
b.Property<string>("ChangedBy")
.HasColumnType("nvarchar(256)")
.HasMaxLength(256);
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime2");
b.Property<string>("CreatedBy")
.HasColumnType("nvarchar(256)")
.HasMaxLength(256);
b.Property<Guid>("DescriptionId")
.HasColumnType("uniqueidentifier");
b.Property<Guid>("NameId")
.HasColumnType("uniqueidentifier");
b.Property<int>("PaceMax")
.HasColumnType("int");
b.Property<int>("PaceMin")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("DescriptionId");
b.HasIndex("NameId");
b.ToTable("GpsSessionTypes");
});
modelBuilder.Entity("Domain.App.Identity.AppRole", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("nvarchar(max)");
b.Property<string>("DisplayName")
.IsRequired()
.HasColumnType("nvarchar(256)")
.HasMaxLength(256);
b.Property<string>("Name")
.HasColumnType("nvarchar(256)")
.HasMaxLength(256);
b.Property<string>("NormalizedName")
.HasColumnType("nvarchar(256)")
.HasMaxLength(256);
b.HasKey("Id");
b.HasIndex("NormalizedName")
.IsUnique()
.HasName("RoleNameIndex")
.HasFilter("[NormalizedName] IS NOT NULL");
b.ToTable("AspNetRoles");
});
modelBuilder.Entity("Domain.App.Identity.AppUser", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<int>("AccessFailedCount")
.HasColumnType("int");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("nvarchar(max)");
b.Property<string>("Email")
.HasColumnType("nvarchar(256)")
.HasMaxLength(256);
b.Property<bool>("EmailConfirmed")
.HasColumnType("bit");
b.Property<string>("FirstName")
.IsRequired()
.HasColumnType("nvarchar(128)")
.HasMaxLength(128);
b.Property<string>("LastName")
.IsRequired()
.HasColumnType("nvarchar(128)")
.HasMaxLength(128);
b.Property<bool>("LockoutEnabled")
.HasColumnType("bit");
b.Property<DateTimeOffset?>("LockoutEnd")
.HasColumnType("datetimeoffset");
b.Property<string>("NormalizedEmail")
.HasColumnType("nvarchar(256)")
.HasMaxLength(256);
b.Property<string>("NormalizedUserName")
.HasColumnType("nvarchar(256)")
.HasMaxLength(256);
b.Property<string>("PasswordHash")
.HasColumnType("nvarchar(max)");
b.Property<string>("PhoneNumber")
.HasColumnType("nvarchar(max)");
b.Property<bool>("PhoneNumberConfirmed")
.HasColumnType("bit");
b.Property<string>("SecurityStamp")
.HasColumnType("nvarchar(max)");
b.Property<bool>("TwoFactorEnabled")
.HasColumnType("bit");
b.Property<string>("UserName")
.HasColumnType("nvarchar(256)")
.HasMaxLength(256);
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasName("EmailIndex");
b.HasIndex("NormalizedUserName")
.IsUnique()
.HasName("UserNameIndex")
.HasFilter("[NormalizedUserName] IS NOT NULL");
b.ToTable("AspNetUsers");
});
modelBuilder.Entity("Domain.App.LangStr", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("ChangedAt")
.HasColumnType("datetime2");
b.Property<string>("ChangedBy")
.HasColumnType("nvarchar(256)")
.HasMaxLength(256);
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime2");
b.Property<string>("CreatedBy")
.HasColumnType("nvarchar(256)")
.HasMaxLength(256);
b.HasKey("Id");
b.ToTable("LangStrs");
});
modelBuilder.Entity("Domain.App.LangStrTranslation", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("ChangedAt")
.HasColumnType("datetime2");
b.Property<string>("ChangedBy")
.HasColumnType("nvarchar(256)")
.HasMaxLength(256);
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime2");
b.Property<string>("CreatedBy")
.HasColumnType("nvarchar(256)")
.HasMaxLength(256);
b.Property<string>("Culture")
.IsRequired()
.HasColumnType("nvarchar(5)")
.HasMaxLength(5);
b.Property<Guid>("LangStrId")
.HasColumnType("uniqueidentifier");
b.Property<string>("Value")
.IsRequired()
.HasColumnType("nvarchar(max)")
.HasMaxLength(10240);
b.HasKey("Id");
b.HasIndex("LangStrId");
b.HasIndex("Culture", "LangStrId")
.IsUnique();
b.ToTable("LangStrTranslation");
});
modelBuilder.Entity("Domain.App.Track", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<Guid>("AppUserId")
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("ChangedAt")
.HasColumnType("datetime2");
b.Property<string>("ChangedBy")
.HasColumnType("nvarchar(256)")
.HasMaxLength(256);
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime2");
b.Property<string>("CreatedBy")
.HasColumnType("nvarchar(256)")
.HasMaxLength(256);
b.Property<Guid>("DescriptionId")
.HasColumnType("uniqueidentifier");
b.Property<string>("MapFile")
.HasColumnType("nvarchar(512)")
.HasMaxLength(512);
b.Property<Guid>("NameId")
.HasColumnType("uniqueidentifier");
b.HasKey("Id");
b.HasIndex("AppUserId");
b.HasIndex("DescriptionId");
b.HasIndex("NameId");
b.ToTable("Tracks");
});
modelBuilder.Entity("Domain.App.TrackPoint", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<double>("Accuracy")
.HasColumnType("float");
b.Property<Guid>("AppUserId")
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("ChangedAt")
.HasColumnType("datetime2");
b.Property<string>("ChangedBy")
.HasColumnType("nvarchar(256)")
.HasMaxLength(256);
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime2");
b.Property<string>("CreatedBy")
.HasColumnType("nvarchar(256)")
.HasMaxLength(256);
b.Property<double>("Latitude")
.HasColumnType("float");
b.Property<double>("Longitude")
.HasColumnType("float");
b.Property<int>("PassOrder")
.HasColumnType("int");
b.Property<Guid>("TrackId")
.HasColumnType("uniqueidentifier");
b.HasKey("Id");
b.HasIndex("AppUserId");
b.HasIndex("TrackId");
b.ToTable("TrackPoints");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<System.Guid>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("ClaimType")
.HasColumnType("nvarchar(max)");
b.Property<string>("ClaimValue")
.HasColumnType("nvarchar(max)");
b.Property<Guid>("RoleId")
.HasColumnType("uniqueidentifier");
b.HasKey("Id");
b.HasIndex("RoleId");
b.ToTable("AspNetRoleClaims");
});