Skip to content

Commit

Permalink
Minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
fstueber committed Sep 23, 2021
1 parent a0368d2 commit 2eafd77
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 29 deletions.
3 changes: 1 addition & 2 deletions src/CommandDefinitions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,8 @@ public static Command Export()
{
var command = new Command("export", "Exports data from Untis to ECF files")
{
new Option(new[] { "--config", "-c" }, "Path to existing JSON configuration file")
new Option<FileInfo>(new[] { "--config", "-c" }, "Path to existing JSON configuration file")
{
Argument = new Argument<FileInfo>(),
IsRequired = true
},
};
Expand Down
10 changes: 5 additions & 5 deletions src/Ecf.Untis.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Enbrea.Csv" Version="0.1.1" />
<PackageReference Include="Enbrea.Ecf" Version="0.1.3" />
<PackageReference Include="Enbrea.Untis.Gpu" Version="0.1.0" />
<PackageReference Include="Enbrea.Untis.Xml" Version="0.1.0" />
<PackageReference Include="System.CommandLine" Version="2.0.0-beta1.20574.7" />
<PackageReference Include="Enbrea.Csv" Version="0.2.1" />
<PackageReference Include="Enbrea.Ecf" Version="0.1.9" />
<PackageReference Include="Enbrea.Untis.Gpu" Version="0.1.1" />
<PackageReference Include="Enbrea.Untis.Xml" Version="0.1.1" />
<PackageReference Include="System.CommandLine" Version="2.0.0-beta1.21308.1" />
</ItemGroup>

<ItemGroup>
Expand Down
3 changes: 2 additions & 1 deletion src/Export/ExportManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ await ecfTableWriter.WriteHeadersAsync(
ecfTableWriter.TrySetValue(EcfHeaders.SubjectId, lesson.SubjectId);
ecfTableWriter.TrySetValue(EcfHeaders.SchoolClassIdList, lesson.ClassIds);
ecfTableWriter.TrySetValue(EcfHeaders.TeacherIdList, lesson.GetEcfTeacherIdList());
ecfTableWriter.TrySetValue(EcfHeaders.RoomIdList, lessonTime.GetEcfRoomIdList());
ecfTableWriter.TrySetValue(EcfHeaders.RoomIdList, lessonTime.RoomIds);
ecfTableWriter.TrySetValue(EcfHeaders.TemporalExpressions, lesson.GetEcfTemporalExpressions(lessonTime, untisDocument.GeneralSettings));

await ecfTableWriter.WriteAsync();
Expand Down Expand Up @@ -776,6 +776,7 @@ await ecfTableWriter.WriteHeadersAsync(

return ecfRecordCounter;
}

private async Task<int> ExportVaccations(UntisDocument untisDocument, EcfTableWriter ecfTableWriter, string[] ecfHeaders)
{
var ecfRecordCounter = 0;
Expand Down
12 changes: 4 additions & 8 deletions src/Extensions/GpuSubstitutionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,18 +112,14 @@ public static List<EcfGapResolution> GetEcfResolutions(this GpuSubstitution subs

public static List<string> GetEcfRoomIdList(this GpuSubstitution substitution)
{
var idList = new List<string>();

if (!string.IsNullOrEmpty(substitution.StandInRoom))
if (substitution.StandInRooms.Count > 0)
{
idList.Add("RM_" + substitution.StandInRoom);
return substitution.StandInRooms.Select(x => "RM_" + x).ToList();
}
else if (!string.IsNullOrEmpty(substitution.Room))
else
{
idList.Add("RM_" + substitution.Room);
return substitution.Rooms.Select(x => "RM_" + x).ToList();
}

return idList;
}

public static List<string> GetEcfSchoolClassIdList(this GpuSubstitution substitution)
Expand Down
13 changes: 0 additions & 13 deletions src/Extensions/UntisLessonTimeExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
using Enbrea.Ecf;
using Enbrea.Untis.Xml;
using System;
using System.Collections.Generic;

namespace Ecf.Untis
{
Expand All @@ -49,18 +48,6 @@ public static string GetEcfId(this UntisLessonTime lessonTime, UntisLesson lesso
{
return lesson.Id + "_" + (uint)lessonTime.Day + "_" + lessonTime.Slot;
}

public static List<string> GetEcfRoomIdList(this UntisLessonTime lessonTime)
{
var idList = new List<string>();

if (!string.IsNullOrEmpty(lessonTime.RoomId))
{
idList.Add(lessonTime.RoomId);
}

return idList;
}
}
}

Expand Down

0 comments on commit 2eafd77

Please sign in to comment.