Skip to content

Commit 380ccb1

Browse files
authored
Merge pull request #1586 from SoftUni-Internal/v2-development
Merge dev into main. Integrate latest bugfixes and improvements.
2 parents d875e84 + 1d79cf3 commit 380ccb1

File tree

178 files changed

+6390
-746
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

178 files changed

+6390
-746
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Playwright Tests (Real Environment)
2+
3+
on:
4+
schedule:
5+
- cron: "0 0 * * *" # Runs every night at 12:00 AM UTC
6+
workflow_dispatch: # Allows manual trigger
7+
8+
jobs:
9+
test:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout Repository
14+
uses: actions/checkout@v4
15+
16+
- name: Setup Node.js
17+
uses: actions/setup-node@v4
18+
with:
19+
node-version: 18
20+
21+
- name: Install Dependencies
22+
working-directory: ./Servers/UI/OJS.Servers.Ui/ClientApp
23+
run: yarn install --frozen-lockfile
24+
25+
- name: Install Playwright Browsers
26+
working-directory: ./Servers/UI/OJS.Servers.Ui/ClientApp
27+
run: yarn playwright install --with-deps
28+
29+
- name: Run Playwright Tests Against Real Environment
30+
working-directory: ./Servers/UI/OJS.Servers.Ui/ClientApp
31+
run: yarn test:e2e:real # Uses script from package.json
32+
env:
33+
TEST_USER_USERNAME: ${{ secrets.TEST_USER_USERNAME }}
34+
TEST_USER_PASSWORD: ${{ secrets.TEST_USER_PASSWORD }}
35+
36+
- name: Upload Playwright Reports
37+
uses: actions/upload-artifact@v4
38+
if: always()
39+
with:
40+
name: playwright-report
41+
path: ./Servers/UI/OJS.Servers.Ui/ClientApp/playwright-report/
42+
retention-days: 7

Common/OJS.Common/Constants/ServiceConstants.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
{
33
public static class ServiceConstants
44
{
5+
public const string WorkersQueueName = "OJS.Servers.Worker.Consumers.SubmissionsForProcessingConsumer";
6+
57
public static class CheckerTypes
68
{
79
public const string ExactMatch = "exact";

Common/OJS.Common/Enumerations/SettingType.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ public enum SettingType
77
LongString = 3,
88
DateTime = 4,
99
Boolean = 5,
10+
Json = 6,
1011
}

Common/OJS.Common/GlobalConstants.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,8 @@ public static class Settings
162162
public const string MaxSubmissionTimeToExecuteAllowedForBatchRetest = "MaxSubmissionTimeToExecuteAllowedForBatchRetest";
163163
public const string MaxSubmissionsCountAllowedForBatchRetest = "MaxSubmissionsCountAllowedForBatchRetest";
164164
public const string MaxWorkersWorkingTimeInSeconds = "MaxWorkersWorkingTimeInSeconds";
165+
166+
public const string ContestLimitBetweenSubmissionsAdjustmentSettings = "ContestLimitBetweenSubmissionsAdjustmentSettings";
165167
}
166168
}
167169
}

Common/OJS.Common/Utils/Calculator.cs

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,48 @@ public static class Calculator
2222

2323
return (byte)age;
2424
}
25+
26+
/// <summary>
27+
/// Linearly interpolate a value within [sourceMin..sourceMax]
28+
/// to a proportionally corresponding value within [targetMin..targetMax] or beyond, depending on 'clamp'.
29+
/// </summary>
30+
/// <param name="value">The current value to map.</param>
31+
/// <param name="sourceMin">Lower bound of the source range.</param>
32+
/// <param name="sourceMax">Upper bound of the source range.</param>
33+
/// <param name="targetMin">Lower bound of the target range.</param>
34+
/// <param name="targetMax">Upper bound of the target range.</param>
35+
/// <param name="clamp">If true, clamp the value to [sourceMin..sourceMax].</param>
36+
/// <returns>A double in [targetMin..targetMax] (if you clamp)
37+
/// or possibly beyond if 'value' is outside [sourceMin..sourceMax].</returns>
38+
public static double LinearInterpolate(
39+
double value,
40+
double sourceMin,
41+
double sourceMax,
42+
double targetMin,
43+
double targetMax,
44+
bool clamp = false)
45+
{
46+
if (clamp)
47+
{
48+
if (value < sourceMin)
49+
{
50+
value = sourceMin;
51+
}
52+
53+
if (value > sourceMax)
54+
{
55+
value = sourceMax;
56+
}
57+
}
58+
59+
// Avoid division by zero
60+
if (Math.Abs(sourceMax - sourceMin) < double.Epsilon)
61+
{
62+
return targetMin;
63+
}
64+
65+
var fraction = (value - sourceMin) / (sourceMax - sourceMin);
66+
return targetMin + (fraction * (targetMax - targetMin));
67+
}
2568
}
2669
}

Data/OJS.Data.Models/Contests/Contest.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ public class Contest : DeletableAuditInfoEntity<int>, IOrderableEntity
8080

8181
public int LimitBetweenSubmissions { get; set; }
8282

83+
public bool AutoChangeLimitBetweenSubmissions { get; set; }
84+
8385
public double OrderBy { get; set; }
8486

8587
public short NumberOfProblemGroups { get; set; }

0 commit comments

Comments
 (0)