Skip to content

Commit

Permalink
Added an option for week type as suffix (fixes #11).
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesgurung committed Jul 6, 2024
1 parent 4964e3e commit 49b6eeb
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ This file is required to configure:
[
{ "originalTitle": "PPA", "newTitle": "" },
{ "originalTitle": "SLT", "newTitle": "SLT Meeting", "newRoom": "Conference Room" }
]
],
"weekTypeAsSuffix": false
}
```
If you specify multiple timings for the same `period`, then when creating each event the app will use the first entry matching any `days` and `yearGroups` filters. Make sure a fallback entry (with no filters) is always provided.
Expand All @@ -69,6 +70,8 @@ You can add duties to staff calendars by setting up break and lunch periods, and

Overriding or renaming a lesson to a blank string (`""`) will prevent a calendar event from being created at that time. The `copyFromPeriod` option can be used to clone another lesson in the same day, for example to create an extended tutor period.

If days are labelled `Mon1` rather than `1Mon`, then `weekTypeAsSuffix` should be set to `true`.

#### days.csv

List each teaching day in the school year, in `yyyy-MM-dd` format, followed by a week indicator (i.e. Week 1 or Week 2). Non-teaching days such as weekends and holidays should be excluded. This file can be created in a spreadsheet app.
Expand Down
4 changes: 2 additions & 2 deletions makecal.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<LangVersion>preview</LangVersion>
<AnalysisMode>AllEnabledByDefault</AnalysisMode>
<AnalysisMode>all</AnalysisMode>
<RootNamespace>TimetableCalendarGenerator</RootNamespace>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<DebugType>None</DebugType>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Azure.Identity" Version="1.11.3" />
<PackageReference Include="Azure.Identity" Version="1.12.0" />
<PackageReference Include="Google.Apis.Calendar.v3" Version="1.68.0.3430" />
<PackageReference Include="KBCsv" Version="6.0.0" />
<PackageReference Include="Microsoft.Graph.Beta" Version="5.78.0-preview" />
Expand Down
2 changes: 1 addition & 1 deletion src/InputReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public static async Task<Settings> LoadSettingsAsync()
}
var date = DateTime.ParseExact(record[0], "yyyy-MM-dd", CultureInfo.InvariantCulture);
var weekType = record.Count > 1 ? record[1] : string.Empty;
settings.DayTypes.Add(date, weekType + date.DayOfWeek.ToString("G")[..3]);
settings.DayTypes.Add(date, settings.WeekTypeAsSuffix ? $"{date:ddd}{weekType}" : $"{weekType}{date:ddd}");
}
}
return settings;
Expand Down
1 change: 1 addition & 0 deletions src/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ public class Settings
public IList<Absence> Absences { get; set; } = [];
public IList<Override> Overrides { get; set; } = [];
public IList<Rename> Renames { get; set; }
public bool WeekTypeAsSuffix { get; set; }

[JsonIgnore]
public IDictionary<DateTime, string> DayTypes { get; set; }
Expand Down

0 comments on commit 49b6eeb

Please sign in to comment.