Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
guru
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DeStream-public
guru
Commits
4b35f4ce
Commit
4b35f4ce
authored
Dec 24, 2018
by
Clint.Network
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Lottery Service and Add Iterator to Draw
parent
bf849588
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
4 deletions
+7
-4
Draw.cs
Stratis.Guru/Models/Draw.cs
+1
-0
Draws.cs
Stratis.Guru/Models/Draws.cs
+4
-1
LotteryService.cs
Stratis.Guru/Services/LotteryService.cs
+2
-3
No files found.
Stratis.Guru/Models/Draw.cs
View file @
4b35f4ce
...
...
@@ -9,5 +9,6 @@ namespace Stratis.Guru.Models
public
ObjectId
Id
{
get
;
set
;
}
public
long
DrawDate
{
get
;
set
;
}
public
bool
Passed
{
get
;
set
;
}
public
uint
BeginIterator
{
get
;
set
;
}
}
}
\ No newline at end of file
Stratis.Guru/Models/Draws.cs
View file @
4b35f4ce
...
...
@@ -12,10 +12,12 @@ namespace Stratis.Guru.Models
public
class
Draws
:
IDraws
{
private
DatabaseContext
_databaseContext
;
private
ISettings
_settings
;
public
Draws
(
DatabaseContext
databaseContext
)
public
Draws
(
DatabaseContext
databaseContext
,
ISettings
settings
)
{
_databaseContext
=
databaseContext
;
_settings
=
settings
;
}
public
string
GetLastDraw
()
...
...
@@ -30,6 +32,7 @@ namespace Stratis.Guru.Models
await
_databaseContext
.
Draws
.
InsertOneAsync
(
new
Draw
()
{
DrawDate
=
nextDrawTimestamp
,
BeginIterator
=
_settings
.
GetIterator
(),
Passed
=
false
});
}
...
...
Stratis.Guru/Services/LotteryService.cs
View file @
4b35f4ce
...
...
@@ -39,7 +39,7 @@ namespace Stratis.Guru.Services
await
InitLotteryAsync
();
await
CalculateNextDrawAsync
();
_updateTimer
.
Interval
=
10
;
_updateTimer
.
Interval
=
TimeSpan
.
FromMinutes
(
5
).
TotalMilliseconds
;
_updateTimer
.
Enabled
=
true
;
_updateTimer
.
Elapsed
+=
async
(
sender
,
args
)
=>
{
...
...
@@ -72,10 +72,9 @@ namespace Stratis.Guru.Services
private
async
Task
CalculateNextDrawAsync
()
{
DateTime
today
=
DateTime
.
UtcNow
;
DateTime
today
=
DateTime
.
UtcNow
.
Date
;
int
daysUntilFriday
=
((
int
)
DayOfWeek
.
Friday
-
(
int
)
today
.
DayOfWeek
+
7
)
%
7
;
_nextDraw
=
today
.
AddDays
(
daysUntilFriday
);
//_nextDraw = DateTime.UtcNow;
var
nextDrawTimestamp
=
((
DateTimeOffset
)
_nextDraw
).
ToUnixTimeSeconds
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment