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
6 changes: 4 additions & 2 deletions AzureDevopsTracker/Adapters/WorkItemAdapter.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using AzureDevopsTracker.DTOs;
using AzureDevopsTracker.Entities;
using AzureDevopsTracker.Extensions;
using AzureDevopsTracker.Interfaces;
using System;
using System.Collections.Generic;
using System.Linq;

Expand Down Expand Up @@ -86,8 +88,8 @@ public TimeByStateDTO ToTimeByStateDTO(TimeByState workItemStatusTime)
{
CreatedAt = workItemStatusTime.CreatedAt,
State = workItemStatusTime.State,
//TotalTime = workItemStatusTime.TotalTimeText,
//TotalWorkedTime = workItemStatusTime.TotalWorkedTimeText
TotalTime = TimeSpan.FromSeconds(workItemStatusTime.TotalTime).ToTextTime(),
TotalWorkedTime = TimeSpan.FromSeconds(workItemStatusTime.TotalWorkedTime).ToTextTime()
};
}

Expand Down
14 changes: 11 additions & 3 deletions AzureDevopsTracker/AzureDevopsTracker.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,30 @@
<Company>TypingHard</Company>
<Product>Azure DevOps Tracker</Product>
<PackageLicenseExpression></PackageLicenseExpression>
<PackageProjectUrl>https://github.com/typinghard/azure-devops-state-tracker</PackageProjectUrl>
<RepositoryUrl>https://github.com/typinghard/azure-devops-state-tracker</RepositoryUrl>
<PackageProjectUrl>https://github.com/typinghard/azure-devops-tracker</PackageProjectUrl>
<RepositoryUrl>https://github.com/typinghard/azure-devops-tracker</RepositoryUrl>
<PackageIcon>adst_icon.png</PackageIcon>
<PackageIconUrl />
<RepositoryType>GitHub</RepositoryType>
<PackageTags>Azure DevOps Tracker Columns State Tracking Track Board Scrum Kanbam Time Column Timing Workitem Worked Hours Team Performance</PackageTags>
<NeutralLanguage>en</NeutralLanguage>
<PackageLicenseFile>LICENSE.md.txt</PackageLicenseFile>
<Description>A NuGet that allows you to use a Azure DevOps Service Hook to track workitems changes in a simply and detailed way.</Description>
<AssemblyVersion>1.0.0.0</AssemblyVersion>
<FileVersion>1.0.0.0</FileVersion>
<Version>1.0.1</Version>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.1.7" />
<PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="1.1.2" />
</ItemGroup>

<ItemGroup>
<None Include="..\..\..\..\..\..\..\Downloads\adst_icon.png">
<Pack>True</Pack>
<PackagePath></PackagePath>
</None>
<None Include="LICENSE.md.txt">
<Pack>True</Pack>
<PackagePath></PackagePath>
Expand Down
12 changes: 6 additions & 6 deletions AzureDevopsTracker/Configurations/Configuration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,22 @@ namespace AzureDevopsTracker.Configurations
{
public static class Configuration
{
public static IServiceCollection AddAzureDevopsStateTracker(this IServiceCollection services, DataBaseConfig configurations)
public static IServiceCollection AddAzureDevopsTracker(this IServiceCollection services, DataBaseConfig configurations)
{
services.AddDbContext<AzureDevopsStateTrackerContext>(options =>
services.AddDbContext<AzureDevopsTrackerContext>(options =>
options.UseSqlServer(DataBaseConfig.ConnectionsString));

services.AddScoped<AzureDevopsStateTrackerContext>();
services.AddScoped<AzureDevopsTrackerContext>();
services.AddScoped<IWorkItemAdapter, WorkItemAdapter>();
services.AddScoped<IWorkItemRepository, WorkItemRepository>();
services.AddScoped<IAzureDevopsStateTrackerService, AzureDevopsStateTrackerService>();
services.AddScoped<IAzureDevopsTrackerService, AzureDevopsTrackerService>();

return services;
}

public static IApplicationBuilder UseAzureDevopsStateTracker(this IApplicationBuilder app, IServiceProvider serviceProvider)
public static IApplicationBuilder UseAzureDevopsTracker(this IApplicationBuilder app, IServiceProvider serviceProvider)
{
var context = serviceProvider.GetService<AzureDevopsStateTrackerContext>();
var context = serviceProvider.GetService<AzureDevopsTrackerContext>();
context.Database.Migrate();

return app;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@

namespace AzureDevopsTracker.Data.Context
{
public class AzureDevopsStateTrackerContext : DbContext, IDisposable
public class AzureDevopsTrackerContext : DbContext, IDisposable
{
public AzureDevopsStateTrackerContext(DbContextOptions options) : base(options)
public AzureDevopsTrackerContext(DbContextOptions options) : base(options)
{ }

public DbSet<WorkItem> WorkItems { get; set; }
Expand Down
4 changes: 2 additions & 2 deletions AzureDevopsTracker/Data/Repository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ namespace AzureDevopsTracker.Data
{
internal abstract class Repository<TEntity> : IRepository<TEntity> where TEntity : Entity
{
protected readonly AzureDevopsStateTrackerContext Db;
protected readonly AzureDevopsTrackerContext Db;
protected readonly DbSet<TEntity> DbSet;

public Repository(AzureDevopsStateTrackerContext db)
public Repository(AzureDevopsTrackerContext db)
{
Db = db;
DbSet = db.Set<TEntity>();
Expand Down
2 changes: 1 addition & 1 deletion AzureDevopsTracker/Data/WorkItemRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace AzureDevopsTracker.Data
{
internal class WorkItemRepository : Repository<WorkItem>, IWorkItemRepository
{
public WorkItemRepository(AzureDevopsStateTrackerContext context) : base(context) { }
public WorkItemRepository(AzureDevopsTrackerContext context) : base(context) { }

public async Task<WorkItem> GetByWorkItemId(string workItemId)
{
Expand Down
2 changes: 1 addition & 1 deletion AzureDevopsTracker/Extensions/HelperExtenions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public static string ExtractEmail(this string user)
public static string ToTextTime(this TimeSpan timeSpan)
{
if (timeSpan.Days > 0)
return $@"{timeSpan:%d} Dia(s) {timeSpan:%h} h e {timeSpan:%m} min e {timeSpan:%s} s";
return $@"{timeSpan:%d} Day(s) {timeSpan:%h} h e {timeSpan:%m} min e {timeSpan:%s} s";

if (timeSpan.Hours > 0)
return $@"{timeSpan:%h} h e {timeSpan:%m} min e {timeSpan:%s} s";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace AzureDevopsTracker.Interfaces
{
public interface IAzureDevopsStateTrackerService
public interface IAzureDevopsTrackerService
{
Task Create(CreateWorkItemDTO createDto, bool addWorkItemChange = true);
Task Update(UpdatedWorkItemDTO updateDto);
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

namespace AzureDevopsTracker.Migrations
{
[DbContext(typeof(AzureDevopsStateTrackerContext))]
[DbContext(typeof(AzureDevopsTrackerContext))]
partial class AzureDevopsStateTrackerContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@

namespace AzureDevopsTracker.Services
{
public class AzureDevopsStateTrackerService : IAzureDevopsStateTrackerService
public class AzureDevopsTrackerService : IAzureDevopsTrackerService
{
public readonly IWorkItemRepository _workItemRepository;
public readonly IWorkItemAdapter _workItemAdapter;

public AzureDevopsStateTrackerService(
public AzureDevopsTrackerService(
IWorkItemAdapter workItemAdapter, IWorkItemRepository workItemRepository)
{
_workItemAdapter = workItemAdapter;
Expand Down Expand Up @@ -103,7 +103,10 @@ public async Task<WorkItemDTO> GetByWorkItemId(string workItemId)
}

#region Support Methods
public WorkItemChange ToWorkItemChange(string workItemId, string changedBy, string iterationPath, DateTime newDate, string newState, string oldState = null, DateTime? oldDate = null)
public WorkItemChange ToWorkItemChange(
string workItemId, string changedBy,
string iterationPath, DateTime newDate, string newState,
string oldState = null, DateTime? oldDate = null)
{
return new WorkItemChange(workItemId, changedBy.ExtractEmail(), iterationPath, newDate, newState, oldState, oldDate);
}
Expand Down