🐛 Activity / localization bug fixes

This commit is contained in:
2025-05-08 22:14:24 +08:00
parent 9b589af816
commit d70b081752
21 changed files with 2859 additions and 190 deletions

View File

@ -271,8 +271,8 @@ public class AccountController(
var today = SystemClock.Instance.GetCurrentInstant().InUtc().Date;
var localTime = new TimeOnly(0, 0);
var startOfDay = today.ToDateOnly().ToDateTime(localTime).ToInstant();
var endOfDay = today.PlusDays(1).ToDateOnly().ToDateTime(localTime).ToInstant();
var startOfDay = today.ToDateOnly().ToDateTime(localTime).ToUniversalTime().ToInstant();
var endOfDay = today.PlusDays(1).ToDateOnly().ToDateTime(localTime).ToUniversalTime().ToInstant();
var result = await db.AccountCheckInResults
.Where(x => x.AccountId == userId)
@ -294,12 +294,13 @@ public class AccountController(
return BadRequest("Check-in is not available for today.");
var needsCaptcha = events.CheckInDailyDoAskCaptcha(currentUser);
if (needsCaptcha && string.IsNullOrWhiteSpace(captchaToken))
return StatusCode(423, "Captcha is required for this check-in.");
if (!await auth.ValidateCaptcha(captchaToken!))
return BadRequest("Invalid captcha token.");
return await events.CheckInDaily(currentUser);
return needsCaptcha switch
{
true when string.IsNullOrWhiteSpace(captchaToken) => StatusCode(423,
"Captcha is required for this check-in."),
true when !await auth.ValidateCaptcha(captchaToken!) => BadRequest("Invalid captcha token."),
_ => await events.CheckInDaily(currentUser)
};
}
[HttpGet("search")]