fix: title-case jobs and skip empty ones
This commit is contained in:
parent
fe65226598
commit
a150c0d76f
|
@ -48,14 +48,17 @@ internal static class BreakdownExt {
|
|||
name => name.ToUpperInvariant()
|
||||
),
|
||||
[Breakdown.MainJob] = Service.DataManager.GetExcelSheet<ClassJob>()!
|
||||
.Where(cj => cj.RowId != 0)
|
||||
.Where(cj => cj.RowId != 0 && !string.IsNullOrWhiteSpace(cj.Name.RawString))
|
||||
.ToDictionary(
|
||||
cj => cj.RowId.ToString(),
|
||||
cj => cj.Name.RawString
|
||||
cj => Util.TitleCase(cj.Name.RawString)
|
||||
),
|
||||
};
|
||||
|
||||
private static Dictionary<Breakdown, string[]> Keys { get; } = new() {
|
||||
[Breakdown.Country] = ISO3166.Country.List
|
||||
.Select(c => c.TwoLetterCode)
|
||||
.ToArray(),
|
||||
[Breakdown.CharacterRace] = Service.DataManager.GetExcelSheet<Race>()!
|
||||
.Where(race => race.RowId != 0)
|
||||
.Select(race => race.RowId.ToString())
|
||||
|
@ -108,13 +111,9 @@ internal static class BreakdownExt {
|
|||
};
|
||||
}
|
||||
|
||||
private static readonly string[] CountryCodes = ISO3166.Country.List
|
||||
.Select(c => c.TwoLetterCode)
|
||||
.ToArray();
|
||||
|
||||
internal static string[] GetBreakdownKeys(this Breakdown breakdown) {
|
||||
return breakdown switch {
|
||||
Breakdown.Country => CountryCodes,
|
||||
Breakdown.Country => Keys[Breakdown.Country],
|
||||
Breakdown.Gender => new[] {
|
||||
"female",
|
||||
"non_binary",
|
||||
|
|
|
@ -10,4 +10,10 @@ internal static class Util {
|
|||
|
||||
return $"{replaced[..1].ToUpperInvariant()}{replaced[1..]}";
|
||||
}
|
||||
|
||||
internal static string TitleCase(string text) {
|
||||
var parts = text.Trim().Split(' ');
|
||||
var capitalised = parts.Select(part => $"{part[..1].ToUpperInvariant()}{part[1..]}");
|
||||
return string.Join(' ', capitalised);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue