Skip to content

Commit 14e78bb

Browse files
committed
Store data each time a new competition is added.
1 parent 4893287 commit 14e78bb

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

Arctic.Puzzlers.Stores/Filestore/JsonCompetitionStore.cs

+8-1
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,14 @@ public void Init()
5151
}
5252

5353
public void Dispose()
54+
{
55+
StoreData();
56+
}
57+
58+
private void StoreData()
5459
{
5560
var folder = m_configuration.GetFileOutputFolder();
56-
var fileName = Path.Combine(folder, JsonFileName);
61+
var fileName = Path.Combine(folder, JsonFileName);
5762

5863
using (FileStream createStream = File.Create(fileName))
5964
{
@@ -68,11 +73,13 @@ public Task<bool> Store(Competition competition)
6873
{
6974
m_competitionList.RemoveAll(t => t.Url == competition.Url);
7075
m_competitionList.Add(competition);
76+
StoreData();
7177
return Task.FromResult(true);
7278
}
7379
else if (!m_competitionList.Any(t => t.Url == competition.Url))
7480
{
7581
m_competitionList.Add(competition);
82+
StoreData();
7683
Task.FromResult(true);
7784
}
7885
return Task.FromResult(false);

0 commit comments

Comments
 (0)