Skip to content

Commit 9327b07

Browse files
authored
Merge 7b1353a into 361aa30
2 parents 361aa30 + 7b1353a commit 9327b07

File tree

2 files changed

+34
-11
lines changed

2 files changed

+34
-11
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
steps:
1616
- uses: actions/checkout@v2
1717

18-
- uses: microsoft/setup-msbuild@v1.0.3
18+
- uses: microsoft/setup-msbuild@v1.3.1
1919

2020
- uses: nuget/setup-nuget@v1
2121
with:

Snittlistan.Web/Commands/PublishRosterMailCommandHandler.cs

Lines changed: 33 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,40 @@ protected override async Task<UpdateRosterEmail> CreateEmail(HandlerContext<Comm
2727
UpdateRosterEmail_State.MatchHeadType matchHead;
2828
if (roster.BitsMatchId != 0)
2929
{
30-
Bits_VMatchHeadInfo matchHeadInfo = await context.Databases.Bits.VMatchHeadInfo.SingleAsync(
30+
Bits_VMatchHeadInfo? matchHeadInfo = await context.Databases.Bits.VMatchHeadInfo.SingleOrDefaultAsync(
3131
x => x.ExternalMatchId == roster.BitsMatchId);
32-
matchHead = new(
33-
"Hemmalag",
34-
matchHeadInfo.HomeTeamAlias,
35-
"Bortalag",
36-
matchHeadInfo.AwayTeamAlias,
37-
matchHeadInfo.HallName,
38-
matchHeadInfo.OilProfileId,
39-
matchHeadInfo.OilProfileName,
40-
matchHeadInfo.MatchDateTime);
32+
if (matchHeadInfo is not null)
33+
{
34+
matchHead = new(
35+
"Hemmalag",
36+
matchHeadInfo.HomeTeamAlias,
37+
"Bortalag",
38+
matchHeadInfo.AwayTeamAlias,
39+
matchHeadInfo.HallName,
40+
matchHeadInfo.OilProfileId,
41+
matchHeadInfo.OilProfileName,
42+
matchHeadInfo.MatchDateTime);
43+
}
44+
else
45+
{
46+
int oilPatternId = 0;
47+
if (roster.OilPattern is not null)
48+
{
49+
int.TryParse(
50+
roster.OilPattern.Url.Substring(roster.OilPattern.Url.LastIndexOf('/') + 1),
51+
out oilPatternId);
52+
}
53+
54+
matchHead = new(
55+
"Lag",
56+
roster.Team ?? "?",
57+
"Motståndare",
58+
roster.Opponent ?? "?",
59+
roster.Location ?? "?",
60+
oilPatternId == 0 ? null : oilPatternId,
61+
roster.OilPattern?.Name ?? "Ingen oljeprofil",
62+
roster.Date);
63+
}
4164
}
4265
else
4366
{

0 commit comments

Comments
 (0)