WIP
This commit is contained in:
@@ -11,7 +11,8 @@ namespace WebAPI.Services.ScheduledTask
|
||||
private readonly LineAutoBotService lineAutoBotService;
|
||||
private readonly ILoggingService loggingService;
|
||||
private readonly PastoralDomainLogic pastoralDomainLogic;
|
||||
private DateTime? nextRunningTime = null;
|
||||
|
||||
public static DateTime? NextRunningTime = null;
|
||||
public MorningPrayer(
|
||||
LineAutoBotService lineAutoBotService,
|
||||
ILoggingService loggingService,
|
||||
@@ -21,19 +22,19 @@ namespace WebAPI.Services.ScheduledTask
|
||||
this.lineAutoBotService = lineAutoBotService;
|
||||
this.loggingService = loggingService;
|
||||
this.pastoralDomainLogic = pastoralDomainLogic;
|
||||
this.SetNextRunningTime();
|
||||
//this.SetNextRunningTime();
|
||||
}
|
||||
public string Description => "Sent out Ark Morning Prayer";
|
||||
|
||||
public bool CheckTime(DateTime time)
|
||||
{
|
||||
if(nextRunningTime == null)
|
||||
if(NextRunningTime == null)
|
||||
{
|
||||
this.SetNextRunningTime();
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
return time >= nextRunningTime.Value;
|
||||
return time >= NextRunningTime.Value;
|
||||
}
|
||||
|
||||
public Task<bool> RunTask()
|
||||
@@ -53,8 +54,8 @@ namespace WebAPI.Services.ScheduledTask
|
||||
}
|
||||
private void SetNextRunningTime()
|
||||
{
|
||||
nextRunningTime = DateTimeHelper.Today().AddDays(1).AddHours(8);
|
||||
loggingService.Log($"Scheduled Task {this.Description}", nextRunningTime.Value);
|
||||
NextRunningTime = DateTimeHelper.Today().AddDays(1).AddHours(8);
|
||||
loggingService.Log($"Scheduled Task {this.Description}", NextRunningTime.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user