Skip to content

Commit 964f0da

Browse files
committed
Fix for problem orders in results page (#467)
1 parent 058467e commit 964f0da

5 files changed

Lines changed: 13 additions & 9 deletions

File tree

Open Judge System/Web/OJS.Web/App_GlobalResources/Global.Designer.cs

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Open Judge System/Web/OJS.Web/App_GlobalResources/Global.resx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,6 @@
121121
<value>Open Judge System (OJS)</value>
122122
</data>
123123
<data name="SystemVersion" xml:space="preserve">
124-
<value>1.3.3396.20140303</value>
124+
<value>1.3.3533.20140419</value>
125125
</data>
126126
</root>

Open Judge System/Web/OJS.Web/Areas/Administration/Controllers/ContestsExportController.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ public FileResult Results(int id, bool compete)
3030

3131
var data = new
3232
{
33-
Id = contest.Id,
34-
Name = contest.Name,
35-
Problems = contest.Problems.AsQueryable().OrderBy(x => x.Name),
33+
contest.Id,
34+
contest.Name,
35+
Problems = contest.Problems.AsQueryable().OrderBy(x => x.OrderBy).ThenBy(x => x.Name),
3636
Questions = contest.Questions.OrderBy(x => x.Id),
3737
Results = this.Data.Participants.All()
3838
.Where(participant => participant.ContestId == contest.Id && participant.IsOfficial == compete)
@@ -145,7 +145,7 @@ public FileResult Results(int id, bool compete)
145145
public ZipFileResult Solutions(int id, bool compete)
146146
{
147147
var contest = this.Data.Contests.GetById(id);
148-
var problems = contest.Problems.OrderBy(x => x.Name).ToList();
148+
var problems = contest.Problems.OrderBy(x => x.OrderBy).ThenBy(x => x.Name).ToList();
149149
var participants =
150150
this.Data.Participants.All()
151151
.Where(x => x.ContestId == id && x.IsOfficial == compete)

Open Judge System/Web/OJS.Web/Areas/Contests/Controllers/ResultsController.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public ActionResult Simple(int id, bool official, int? page)
104104
ContestCanBeCompeted = contest.CanBeCompeted,
105105
ContestCanBePracticed = contest.CanBePracticed,
106106
Problems = contest.Problems.AsQueryable().Where(x => !x.IsDeleted)
107-
.Select(ContestProblemViewModel.FromProblem).OrderBy(x => x.Name),
107+
.Select(ContestProblemViewModel.FromProblem).OrderBy(x => x.OrderBy).ThenBy(x => x.Name),
108108
Results = this.Data.Participants.All()
109109
.Where(participant => participant.ContestId == contest.Id && participant.IsOfficial == official)
110110
.Select(participant => new ParticipantResultViewModel
@@ -180,7 +180,7 @@ public ActionResult Full(int id, bool official)
180180
{
181181
Id = contest.Id,
182182
Name = contest.Name,
183-
Problems = contest.Problems.AsQueryable().Where(pr => !pr.IsDeleted).Select(ContestProblemViewModel.FromProblem).OrderBy(x => x.Name),
183+
Problems = contest.Problems.AsQueryable().Where(pr => !pr.IsDeleted).Select(ContestProblemViewModel.FromProblem).OrderBy(x => x.OrderBy).ThenBy(x => x.Name),
184184
Results = this.Data.Participants.All()
185185
.Where(participant => participant.ContestId == contest.Id && participant.IsOfficial == official)
186186
.Select(participant => new ParticipantFullResultViewModel

Open Judge System/Web/OJS.Web/Areas/Contests/ViewModels/Contests/ContestProblemViewModel.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ public ContestProblemViewModel(Problem problem)
1919
{
2020
this.ProblemId = problem.Id;
2121
this.Name = problem.Name;
22+
this.OrderBy = problem.OrderBy;
2223
this.ContestId = problem.ContestId;
2324
this.ShowResults = problem.ShowResults;
2425
this.Resources = problem.Resources.AsQueryable()
@@ -45,6 +46,7 @@ public static Expression<Func<Problem, ContestProblemViewModel>> FromProblem
4546
return problem => new ContestProblemViewModel
4647
{
4748
Name = problem.Name,
49+
OrderBy = problem.OrderBy,
4850
ProblemId = problem.Id,
4951
ContestId = problem.ContestId,
5052
MemoryLimit = problem.MemoryLimit,
@@ -67,6 +69,8 @@ public static Expression<Func<Problem, ContestProblemViewModel>> FromProblem
6769

6870
public string Name { get; set; }
6971

72+
public int OrderBy { get; set; }
73+
7074
public bool ShowResults { get; set; }
7175

7276
public double MemoryLimit

0 commit comments

Comments
 (0)