add reset every x amount of time feature

This commit is contained in:
Kukks
2019-01-04 11:42:37 +01:00
parent c52a49f747
commit 7768f41849
9 changed files with 133 additions and 37 deletions

View File

@@ -37,6 +37,8 @@ namespace BTCPayServer.Controllers
public string DisqusShortname { get; set; }
public bool AnimationsEnabled { get; set; }
public bool UseInvoiceAmount { get; set; }
public int ResetEveryAmount { get; set; }
public CrowdfundResetEvery ResetEvery { get; set; }
}
@@ -68,7 +70,9 @@ namespace BTCPayServer.Controllers
SoundsEnabled = settings.SoundsEnabled,
DisqusShortname = settings.DisqusShortname,
AnimationsEnabled = settings.AnimationsEnabled,
UseInvoiceAmount = settings.UseInvoiceAmount
UseInvoiceAmount = settings.UseInvoiceAmount,
ResetEveryAmount = settings.ResetEveryAmount,
ResetEvery = Enum.GetName(typeof(CrowdfundResetEvery), settings.ResetEvery),
};
return View(vm);
}
@@ -116,7 +120,8 @@ namespace BTCPayServer.Controllers
SoundsEnabled = vm.SoundsEnabled,
DisqusShortname = vm.DisqusShortname,
AnimationsEnabled = vm.AnimationsEnabled,
ResetEveryAmount = vm.ResetEveryAmount,
ResetEvery = Enum.Parse<CrowdfundResetEvery>(vm.ResetEvery),
UseInvoiceAmount = vm.UseInvoiceAmount
});
await UpdateAppSettings(app);

View File

@@ -122,12 +122,14 @@ namespace BTCPayServer.Controllers
var info = await _CrowdfundHubStreamer.GetCrowdfundInfo(appId);
if(!isAdmin &&
((settings.StartDate.HasValue && DateTime.Now < settings.StartDate) ||
(settings.EndDate.HasValue && DateTime.Now > settings.EndDate) ||
(settings.EnforceTargetAmount && (info.Info.PendingProgressPercentage.GetValueOrDefault(0) + info.Info.ProgressPercentage.GetValueOrDefault(0)) >= 100)))
(settings.EnforceTargetAmount &&
(info.Info.PendingProgressPercentage.GetValueOrDefault(0) +
info.Info.ProgressPercentage.GetValueOrDefault(0)) >= 100)))
{
return NotFound();
}
var store = await _AppsHelper.GetStore(app);