Skip to content

Commit

Permalink
Merge pull request #64 from carlst99/develop
Browse files Browse the repository at this point in the history
Release v1.0.2
  • Loading branch information
carlst99 committed Apr 11, 2020
2 parents 1f3f2a5 + ef06137 commit fc7c245
Show file tree
Hide file tree
Showing 47 changed files with 617 additions and 134 deletions.
17 changes: 3 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,7 @@
# TrialManager
TrialManager helps NZ sheepdog trialing clubs to create draws for their trials.
It uses data from a CSV file, generally downloaded from Google Forms, and sorts trialists into a draw based on certain parameters, such as their preferred day and distance to the trial grounds.
TrialManager is a solution for New Zealand sheepdog trialing clubs that accelerates and eases the process of making draws for their trials.

TrialManager currently only works on Windows computers with a .NET Core 3.1 runtime.
It uses data from a CSV file, generally downloaded from Google Forms, and sorts trialists into a draw based on certain parameters, such as their preferred day and distance to the trial grounds.

### Important :warning:
TrialManager is still in development and is undergoing regular, significant feature changes. Furthermore, it is not fully hand or unit tested and should therefore be considered unreliable.
Please use only if you understand what you are doing.

### Roadmap
**Update**

We are nearing the release of the first version. Please hold tight!

---
I intend to release TrialManager only when I am confident that all features work properly and it is customisable to the extent that it will fulfil the requirements of most different trial formats.
This means a significant amount of work and testing is required before I start work on release features like installers and documentation.
TrialManager is still in development and is not fully hand or unit tested and should therefore be considered unreliable. Furthermore, documentation is at a minimum. You are welcome to install TrialManager and try it out, however be aware that it may not perform as expected.
7 changes: 4 additions & 3 deletions TrialManager/Bootstrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ protected override void OnStart()
throw new ApplicationException("Remember AppCenter key!");
Preferences _preferences = RealmHelpers.GetUserPreferences(RealmHelpers.GetRealmInstance());
if (_preferences.IsDiagnosticsEnabled)
AppCenter.Start("{Your App Secret}", typeof(Analytics), typeof(Crashes));
AppCenter.Start("{App Secret}", typeof(Analytics), typeof(Crashes));
#endif

base.OnStart();
Expand All @@ -44,10 +44,11 @@ protected override void ConfigureIoC(IStyletIoCBuilder builder)
builder.Bind<ICsvImportService>().To<CsvImportService>().InSingletonScope();
builder.Bind<IDataExportService>().To<DataExportService>().InSingletonScope();
builder.Bind<IDrawCreationService>().To<DrawCreationService>().InSingletonScope();
builder.Bind<EventSeparatorService>().ToSelf().InSingletonScope();
builder.Bind<ILocationService>().To<LocationService>().InSingletonScope();
builder.Bind<IPrintService>().To<PrintService>().InSingletonScope();
builder.Bind<PrintService>().ToSelf().InSingletonScope();
//Bind UI services
builder.Bind<INavigationService>().To<NavigationService>().InSingletonScope();
builder.Bind<NavigationService>().ToSelf().InSingletonScope();
builder.Bind<ISnackbarMessageQueue>().ToFactory(_ => new SnackbarMessageQueue(new TimeSpan(0, 0, 5))).InSingletonScope();

base.ConfigureIoC(builder);
Expand Down
4 changes: 2 additions & 2 deletions TrialManager/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,6 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0")]
[assembly: AssemblyFileVersion("1.0.0")]
[assembly: AssemblyVersion("1.0.2")]
[assembly: AssemblyFileVersion("1.0.2")]
[assembly: NeutralResourcesLanguage("en-NZ")]
3 changes: 3 additions & 0 deletions TrialManager/Resources/HelpUrls.resx
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@
<data name="Default" xml:space="preserve">
<value>https://carlst99.github.io/TrialManager</value>
</data>
<data name="EventSeparation" xml:space="preserve">
<value>https://carlst99.github.io/TrialManager/google-forms/advanced-forms/#formatting-the-data</value>
</data>
<data name="IOException" xml:space="preserve">
<value />
</data>
Expand Down

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

3 changes: 2 additions & 1 deletion TrialManager/Services/CsvImportService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,11 @@ public async Task<bool> IsValidCsvFile(string filePath)
}

/// <summary>
/// Gets a CSV reader setup with an <see cref="EntityStatusConverter"/> and provided classmap
/// Gets a CSV reader setup with the provided classmap and a string trimmer
/// </summary>
/// <param name="filePath">The path to the file upon which a CSV reader should be open</param>
/// <param name="classMap">The classmap to use</param>
/// <remarks>If the provided classmap is null, no <see cref="ClassMap"/> will be registered</remarks>
/// <returns></returns>
public CsvReader GetCsvReader(string filePath, ClassMap<MappedTrialist> classMap = null)
{
Expand Down
2 changes: 1 addition & 1 deletion TrialManager/Services/DrawCreationService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ private IEnumerable<TrialistDrawEntry> SpreadAndGenerateRuns(IEnumerable<Trialis
foreach (Trialist trialist in trialists)
dogCount += trialist.Dogs.Count;

TrialistDrawEntry[] draw = new TrialistDrawEntry[dogCount * 2];
TrialistDrawEntry[] draw = new TrialistDrawEntry[dogCount * minRunSeparation];
HashSet<int> usedNumbers = new HashSet<int>();
const int startCount = 0;
int count = 0;
Expand Down
55 changes: 55 additions & 0 deletions TrialManager/Services/EventSeparatorService.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
using CsvHelper;
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;

namespace TrialManager.Services
{
public class EventSeparatorService
{
private readonly ICsvImportService _importService;

public EventSeparatorService(ICsvImportService importService)
{
_importService = importService;
}

public async Task Separate(string path, int headerIndex)
{
List<string> recordEvents = new List<string>();

using (CsvReader reader = _importService.GetCsvReader(path))
{
await reader.ReadAsync().ConfigureAwait(false); // Make sure that we don't read the header record
while (await reader.ReadAsync().ConfigureAwait(false))
recordEvents.Add(reader.GetField(headerIndex));
}

Dictionary<string, StreamWriter> eventFileWriters = new Dictionary<string, StreamWriter>();
string fileName = path.Replace(".csv", string.Empty);

using (StreamReader sr = new StreamReader(path))
{
string headerRecord = await sr.ReadLineAsync().ConfigureAwait(false);

foreach (string rEvent in recordEvents)
{
if (!eventFileWriters.ContainsKey(rEvent))
{
string filePath = fileName + " - " + rEvent + ".csv";
eventFileWriters.Add(rEvent, new StreamWriter(filePath));
await eventFileWriters[rEvent].WriteLineAsync(headerRecord).ConfigureAwait(false);
}
string record = await sr.ReadLineAsync().ConfigureAwait(false);
await eventFileWriters[rEvent].WriteLineAsync(record).ConfigureAwait(false);
}
}

foreach (StreamWriter sw in eventFileWriters.Values)
{
await sw.FlushAsync().ConfigureAwait(false);
sw.Dispose();
}
}
}
}
14 changes: 0 additions & 14 deletions TrialManager/Services/INavigationService.cs

This file was deleted.

10 changes: 0 additions & 10 deletions TrialManager/Services/IPrintService.cs

This file was deleted.

4 changes: 3 additions & 1 deletion TrialManager/Services/NavigationService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@

namespace TrialManager.Services
{
public class NavigationService : INavigationService
public delegate void NavigationEventHandler<TViewModel, TPayload>(object sender, TViewModel e, TPayload p);

public class NavigationService
{
/// <summary>
/// Invoked when a navigation is requested
Expand Down
2 changes: 1 addition & 1 deletion TrialManager/Services/PrintService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

namespace TrialManager.Services
{
public class PrintService : IPrintService
public class PrintService
{
public bool Print(IEnumerable<TrialistDrawEntry> drawEntries, string title)
{
Expand Down
Loading

0 comments on commit fc7c245

Please sign in to comment.