From 2eafd77bffd6772d60b582b0883e12436686ac35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frank=20St=C3=BCber?= Date: Thu, 23 Sep 2021 18:13:11 +0200 Subject: [PATCH] Minor changes --- src/CommandDefinitions.cs | 3 +-- src/Ecf.Untis.csproj | 10 +++++----- src/Export/ExportManager.cs | 3 ++- src/Extensions/GpuSubstitutionExtensions.cs | 12 ++++-------- src/Extensions/UntisLessonTimeExtensions.cs | 13 ------------- 5 files changed, 12 insertions(+), 29 deletions(-) diff --git a/src/CommandDefinitions.cs b/src/CommandDefinitions.cs index 131343a..1a76a1d 100644 --- a/src/CommandDefinitions.cs +++ b/src/CommandDefinitions.cs @@ -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(new[] { "--config", "-c" }, "Path to existing JSON configuration file") { - Argument = new Argument(), IsRequired = true }, }; diff --git a/src/Ecf.Untis.csproj b/src/Ecf.Untis.csproj index 0c10d12..469f33c 100644 --- a/src/Ecf.Untis.csproj +++ b/src/Ecf.Untis.csproj @@ -13,11 +13,11 @@ - - - - - + + + + + diff --git a/src/Export/ExportManager.cs b/src/Export/ExportManager.cs index f8a3302..25c5ef0 100644 --- a/src/Export/ExportManager.cs +++ b/src/Export/ExportManager.cs @@ -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(); @@ -776,6 +776,7 @@ await ecfTableWriter.WriteHeadersAsync( return ecfRecordCounter; } + private async Task ExportVaccations(UntisDocument untisDocument, EcfTableWriter ecfTableWriter, string[] ecfHeaders) { var ecfRecordCounter = 0; diff --git a/src/Extensions/GpuSubstitutionExtensions.cs b/src/Extensions/GpuSubstitutionExtensions.cs index ffa8fb0..54adc26 100644 --- a/src/Extensions/GpuSubstitutionExtensions.cs +++ b/src/Extensions/GpuSubstitutionExtensions.cs @@ -112,18 +112,14 @@ public static List GetEcfResolutions(this GpuSubstitution subs public static List GetEcfRoomIdList(this GpuSubstitution substitution) { - var idList = new List(); - - 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 GetEcfSchoolClassIdList(this GpuSubstitution substitution) diff --git a/src/Extensions/UntisLessonTimeExtensions.cs b/src/Extensions/UntisLessonTimeExtensions.cs index e51577b..5c1577a 100644 --- a/src/Extensions/UntisLessonTimeExtensions.cs +++ b/src/Extensions/UntisLessonTimeExtensions.cs @@ -22,7 +22,6 @@ using Enbrea.Ecf; using Enbrea.Untis.Xml; using System; -using System.Collections.Generic; namespace Ecf.Untis { @@ -49,18 +48,6 @@ public static string GetEcfId(this UntisLessonTime lessonTime, UntisLesson lesso { return lesson.Id + "_" + (uint)lessonTime.Day + "_" + lessonTime.Slot; } - - public static List GetEcfRoomIdList(this UntisLessonTime lessonTime) - { - var idList = new List(); - - if (!string.IsNullOrEmpty(lessonTime.RoomId)) - { - idList.Add(lessonTime.RoomId); - } - - return idList; - } } }