Skip to content

Commit 12ecc85

Browse files
committed
only redirect when isValidationOnly
1 parent 25dd50d commit 12ecc85

File tree

1 file changed

+23
-19
lines changed

1 file changed

+23
-19
lines changed

ProblemSource/ProblemSourceModule/ProblemSourceProcessingMiddleware.cs

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -101,29 +101,33 @@ public async Task Invoke(HttpContext context, RequestDelegate next)
101101
else
102102
{
103103
string? redirectToNewClient = null;
104-
if (context.Request.Query["newclient"].FirstOrDefault() == "1")
104+
if (isValidationOnly)
105105
{
106-
redirectToNewClient = "indexnew.html";
107-
}
108-
else
109-
{
110-
var training = await GetTrainingOrThrow(trainingId2, context.User);
111-
if (!string.IsNullOrEmpty(training.Settings.RedirectToClient))
106+
if (context.Request.Query["newclient"].FirstOrDefault() == "1")
112107
{
113-
redirectToNewClient = training.Settings.RedirectToClient;
108+
redirectToNewClient = "indexnew.html";
109+
}
110+
else
111+
{
112+
var training = await GetTrainingOrThrow(trainingId2, context.User);
113+
if (!string.IsNullOrEmpty(training.Settings.RedirectToClient))
114+
{
115+
redirectToNewClient = training.Settings.RedirectToClient;
116+
}
117+
//else if (trainingId2 % 10 == 6) // redirect some users to the new client
118+
//{
119+
// var sessionInfo = sessionManager.GetByUserId(training.Username);
120+
// if (sessionInfo?.AlreadyExisted != true) // if they encounter a problem and reload, switch back to original client
121+
// {
122+
// var session = AssertSession(training, null, null);
123+
// var days = await session.TrainingDays.GetAll();
124+
// if (days.Any() && days.Max(o => o.TrainingDay) == 5)
125+
// redirectToNewClient = "indexnew.html";
126+
// }
127+
//}
114128
}
115-
//else if (trainingId2 % 10 == 6) // redirect some users to the new client
116-
//{
117-
// var sessionInfo = sessionManager.GetByUserId(training.Username);
118-
// if (sessionInfo?.AlreadyExisted != true) // if they encounter a problem and reload, switch back to original client
119-
// {
120-
// var session = AssertSession(training, null, null);
121-
// var days = await session.TrainingDays.GetAll();
122-
// if (days.Any() && days.Max(o => o.TrainingDay) == 5)
123-
// redirectToNewClient = "indexnew.html";
124-
// }
125-
//}
126129
}
130+
127131
if (!string.IsNullOrEmpty(redirectToNewClient))
128132
result = new SyncResult { messages = $"redirect://{redirectToNewClient}?autologin={root.Uuid}" };
129133
else

0 commit comments

Comments
 (0)