[algospot-judge] r223 committed - ranklist do not show submissions for other problems

0 views
Skip to first unread message

codesite...@google.com

unread,
Jul 11, 2010, 4:08:11 AM7/11/10
to algospo...@googlegroups.com
Revision: 223
Author: jongman
Date: Sat Jul 10 22:19:20 2010
Log: ranklist do not show submissions for other problems
http://code.google.com/p/algospot-judge/source/detail?r=223

Modified:
/trunk/vanillaapp/controllers/class.judgeinterfacecontroller.php
/trunk/vanillaapp/controllers/class.problemscontroller.php
/trunk/vanillaapp/models/class.submissionmodel.php
/trunk/vanillaapp/views/problems/ranklist.php
/trunk/vanillaapp/views/problems/submission.php

=======================================
--- /trunk/vanillaapp/controllers/class.judgeinterfacecontroller.php Sat
Jul 10 22:16:11 2010
+++ /trunk/vanillaapp/controllers/class.judgeinterfacecontroller.php Sat
Jul 10 22:19:20 2010
@@ -45,7 +45,7 @@
SubmissionState::OK));
}

- $Submissions = $this->SubmissionModel->GetList(FALSE, TRUE, 1000,
0, $ExcludeStates);
+ $Submissions = $this->SubmissionModel->GetList(FALSE, TRUE, FALSE,
1000, 0, $ExcludeStates);
$this->MasterView = "json";
$this->SetData("Submissions", $Submissions, TRUE);
$this->SetData("RequestAll", $RequestAll, TRUE);
=======================================
--- /trunk/vanillaapp/controllers/class.problemscontroller.php Sat Jul 10
22:19:01 2010
+++ /trunk/vanillaapp/controllers/class.problemscontroller.php Sat Jul 10
22:19:20 2010
@@ -317,20 +317,18 @@
$this->MasterView = "json";
$params =
$this->ParseDataTablesQuery(array("No", "Problem", "Author", "Language", "Length", "State",
array("Time", "Memory"), "Submitted"));
$ShowHidden = $this->IsAdmin();
- if(isset($_GET["Author"]) && $_GET["Author"] != -1) {
- $Author = $_GET["Author"];
- }
- else {
- $Author = FALSE;
- }
+ $Author = FALSE;
+ if(isset($_GET["Author"]) && $_GET["Author"] != -1) $Author =
$_GET["Author"];
+ $Problem = FALSE;
+ if(isset($_GET["Problem"]) && $_GET["Problem"] != -1) $Problem =
$_GET["Problem"];
$ExcludeState = array();
if(isset($_GET["State"])) {
for($i = 0; $i < 11; ++$i)
if($_GET["State"] != $i)
array_push($ExcludeState, $i);
}
- $Count = $this->SubmissionModel->GetCount($Author, $ShowHidden,
$ExcludeState);
- $Submissions = $this->SubmissionModel->GetList($Author,
$ShowHidden, $params["Limit"], $params["Offset"], $ExcludeState,
$params["OrderFields"], $params["OrderDirection"]);
+ $Count = $this->SubmissionModel->GetCount($Author, $ShowHidden,
$Problem, $ExcludeState);
+ $Submissions = $this->SubmissionModel->GetList($Author,
$ShowHidden, $Problem, $params["Limit"], $params["Offset"], $ExcludeState,
$params["OrderFields"], $params["OrderDirection"]);
$this->SetData("Count", $Count, TRUE);
$this->SetData("Submissions", $Submissions, TRUE);
$this->Render();
=======================================
--- /trunk/vanillaapp/models/class.submissionmodel.php Sat Jul 10 22:18:17
2010
+++ /trunk/vanillaapp/models/class.submissionmodel.php Sat Jul 10 22:19:20
2010
@@ -55,7 +55,7 @@
$this->SQL->Put("Submission", $NewValues, array("No" => $No));
}

- public function GetList($Author, $ShowHidden, $Limit, $Offset,
$ExcludeState=array(), $SortBy="No", $SortDirection="desc") {
+ public function GetList($Author, $ShowHidden, $Problem, $Limit,
$Offset, $ExcludeState=array(), $SortBy="No", $SortDirection="desc") {
$this->SQL->Select("s.No", "", "No")
->Select("p.ID", "", "ProblemID")
->Select("s.Problem", "", "Problem")
@@ -78,7 +78,7 @@
$this->SQL->Join("Problem p", "p.No = s.Problem", "left");
$Session = Gdn::Session();
$UserID = $Session->IsValid() ? $Session->UserID : -1;
- $this->Where($Author, $ShowHidden, $UserID, $ExcludeState);
+ $this->Where($Author, $ShowHidden, $Problem, $UserID,
$ExcludeState);
$this->SQL->Limit($Limit, $Offset);
$ret = $this->SQL->Get()->Result();
for($i = 0; $i < Count($ret); ++$i) {
@@ -102,18 +102,18 @@
return $ret;
}

- public function GetCount($Author, $ShowHidden, $ExcludeState=array()) {
+ public function GetCount($Author, $ShowHidden, $Problem,
$ExcludeState=array()) {
$Session = Gdn::Session();
$UserID = $Session->IsValid() ? $Session->UserID : -1;

$this->SQL->Select("Count(No) as Cnt")->From("Submission s");
- $this->Where($Author, $ShowHidden, $UserID, $ExcludeState);
+ $this->Where($Author, $ShowHidden, $Problem, $UserID,
$ExcludeState);
$ret = $this->SQL->Get();
return $ret->FirstRow()->Cnt;
}

- private function Where($Author, $ShowHidden, $UserID=-1,
$ExcludeState=array()) {
- if($Author !== FALSE || !$ShowHidden || count($ExcludeState) > 0) {
+ private function Where($Author, $ShowHidden, $Problem, $UserID=-1,
$ExcludeState=array()) {
+ if($Author !== FALSE || !$ShowHidden || count($ExcludeState) > 0 |
| $Problem != FALSE) {
$this->SQL->BeginWhereGroup();
$first = true;
if($Author !== FALSE) {
@@ -122,6 +122,12 @@
$this->SQL->EndWhereGroup();
$first = false;
}
+ if($Problem !== FALSE) {
+ $this->SQL->BeginWhereGroup();
+ $this->SQL->Where("s.Problem", $Problem);
+ $this->SQL->EndWhereGroup();
+ $first = false;
+ }
if(!$ShowHidden) {
if(!$first) $this->SQL->AndOp();
$this->SQL->BeginWhereGroup();
=======================================
--- /trunk/vanillaapp/views/problems/ranklist.php Sat Jul 10 22:18:10 2010
+++ /trunk/vanillaapp/views/problems/ranklist.php Sat Jul 10 22:19:20 2010
@@ -76,6 +76,7 @@
}
aoData.push({ name: "DeliveryType", value: 3});
aoData.push({ name: "State", value:
<?=SubmissionState::ACCEPTED?>});
+ aoData.push({ name: "Problem", value:
<?=$this->Problem->No?>});
$.getJSON( sSource, aoData, fnCallback);
},
"aaSorting": [[4, "asc"]],
=======================================
--- /trunk/vanillaapp/views/problems/submission.php Sat Jul 10 22:17:49 2010
+++ /trunk/vanillaapp/views/problems/submission.php Sat Jul 10 22:19:20 2010
@@ -1,4 +1,4 @@
-<div class="Submission">
+<div class="Submission Section">
<h2>Submission #<?=$this->Submission->No?></h2>
<table cellpadding="0" cellspacing="0" border="0" class="display"
id="SubmissionInfo" width="100%">
<thead>
@@ -30,7 +30,7 @@
$this->Submission->State == SubmissionState::COMPILE_ERROR ||
$this->Submission->State == SubmissionState::CANT_BE_JUDGED) {
?>
-<div class="Submission">
+<div class="Submission Section">
<h2>Message</h2>

<pre
class="ErrorMessage"><?=htmlentities($this->Submission->Message)?></pre>

Reply all
Reply to author
Forward
0 new messages