Skip to content
Permalink
Browse files

Added language info on problem submits list.

  • Loading branch information
espr1t committed Jan 28, 2020
1 parent dcb8970 commit 06093488ff5c97bea725bd6603d0203e65846f08
Showing with 32 additions and 15 deletions.
  1. +4 −2 web/code/db/brain.php
  2. +4 −0 web/code/db/init.php
  3. +12 −0 web/code/db/migrate.php
  4. +5 −10 web/code/games.php
  5. +4 −2 web/code/problems.php
  6. +3 −1 web/code/queue.php
@@ -575,14 +575,15 @@ function getPending() {

function addPending($submit) {
$response = $this->db->query("
INSERT INTO `Pending`(submitId, userId, userName, problemId, problemName, time, progress, status)
INSERT INTO `Pending`(submitId, userId, userName, problemId, problemName, time, language, progress, status)
VALUES (
'" . $submit->id . "',
'" . $submit->userId . "',
'" . $submit->userName . "',
'" . $submit->problemId . "',
'" . $submit->problemName . "',
'" . $submit->submitted . "',
'" . $submit->language . "',
'" . 0 . "',
'" . $submit->status . "'
)
@@ -634,14 +635,15 @@ function getLatest() {

function addLatest($submit) {
$response = $this->db->query("
INSERT INTO `Latest`(submitId, userId, userName, problemId, problemName, time, progress, status)
INSERT INTO `Latest`(submitId, userId, userName, problemId, problemName, time, language, progress, status)
VALUES (
'" . $submit->id . "',
'" . $submit->userId . "',
'" . $submit->userName . "',
'" . $submit->problemId . "',
'" . $submit->problemName . "',
'" . $submit->submitted . "',
'" . $submit->language . "',
'" . 1 . "',
'" . $submit->status . "'
)
@@ -388,6 +388,7 @@ function output($message) {
"problemId": 1,
"problemName": "Input/Output",
"time": "2016-08-30 00:24:11",
"language": "C++",
"progress": 0.66,
"status": "W"
}
@@ -407,6 +408,7 @@ function output($message) {
problemId INT NOT NULL,
problemName VARCHAR(32) NOT NULL,
time DATETIME NOT NULL,
language VARCHAR(8) NOT NULL,
progress FLOAT NOT NULL,
status VARCHAR(2) NOT NULL,
PRIMARY KEY (id)
@@ -426,6 +428,7 @@ function output($message) {
"problemId": 1,
"problemName": "Input/Output",
"time": "2016-08-29 23:54:33",
"language": "C++",
"progress": 1.0,
"status": "AC"
}
@@ -445,6 +448,7 @@ function output($message) {
problemId INT NOT NULL,
problemName VARCHAR(32) NOT NULL,
time DATETIME NOT NULL,
language VARCHAR(8) NOT NULL,
progress FLOAT NOT NULL,
status VARCHAR(2) NOT NULL,
PRIMARY KEY (id)
@@ -18,6 +18,18 @@ function output($message) {

$brain = new Brain();


/*
output('Filling "language" info...');
$data = $brain->getLatest();
for ($i = 0; $i < count($data); $i = $i + 1) {
$entry = $data[$i];
$submit = $brain->getSubmit($entry['submitId']);
$brain->addLatestLanguage($submit['id'], $submit['language']);
}
*/

/*
output('Filling "last seen" info...');
$numUpdated = 0;
@@ -481,17 +481,10 @@ private function getRelativeStatement($problem) {
';
}

if ($problem->name == 'HyperWords' || $problem->name == 'Airports' || $problem->name == "ImageScanner") {
if ($problem->name == 'HyperWords' || $problem->name == 'Airports' || $problem->name == 'ImageScanner') {
$visualizerButton = '';
}

// if ($problem->name == 'ImageScanner' && $this->user->id > 1) {
// $submitButton = '
// <input type="submit" value="Изпрати Решение" class="button button-large button-color-gray"
// title="Събмитването по задачата е временно спряно.">
// ';
// }

$controlButtons = '
<div class="center">
' . $submitButton . '
@@ -1024,9 +1017,10 @@ private function getAllSubmitsBox($problem) {
$submitList .= '
<tr>
<td>' . ($i + 1) . '</td>
<td>' . $submitLink . '</td>
<td>' . explode(' ', $submit->submitted)[0] . '</td>
<td>' . explode(' ', $submit->submitted)[1] . '</td>
<td>' . $submitLink . '</td>
<td>' . $submit->language . '</td>
<td>' . $GLOBALS['STATUS_DISPLAY_NAME'][$submit->calcStatus()] . '</td>
<td>' . ($finalFull == $submit->id ? '<i class="fa fa-check green"></i>' : '') . '</td>
</tr>
@@ -1038,9 +1032,10 @@ private function getAllSubmitsBox($problem) {
<table class="default">
<tr>
<th>#</th>
<th>ID</th>
<th>Дата</th>
<th>Час</th>
<th>Идентификатор</th>
<th>Език</th>
<th>Статус</th>
<th>Финално</th>
</tr>
@@ -599,9 +599,10 @@ private function getAllSubmitsBox($problem) {
$submitList .= '
<tr>
<td>' . ($i + 1) . '</td>
<td>' . $submitLink . '</td>
<td>' . explode(' ', $submit->submitted)[0] . '</td>
<td>' . explode(' ', $submit->submitted)[1] . '</td>
<td>' . $submitLink . '</td>
<td>' . $submit->language . '</td>
<td>' . $GLOBALS['STATUS_DISPLAY_NAME'][$submit->calcStatus()] . '</td>
<td>' . round($submit->calcScore(), 3) . '</td>
</tr>
@@ -613,9 +614,10 @@ private function getAllSubmitsBox($problem) {
<table class="default">
<tr>
<th>#</th>
<th>ID</th>
<th>Дата</th>
<th>Час</th>
<th>Идентификатор</th>
<th>Език</th>
<th>Статус</th>
<th>Точки</th>
</tr>
@@ -74,6 +74,7 @@ private function getQueueTable($data) {
<td>' . $userEl . '</td>
<td>' . $problemEl . '</td>
<td title="' . $entry['time'] . '">' . explode(' ', $entry['time'])[1] . '</td>
<td>' . $entry['language'] . '</td>
<td>' . intval($entry['progress'] * 100) . '%</td>
<td>' . $GLOBALS['STATUS_DISPLAY_NAME'][$entry['status']] . '</td>
' . $regradeSubmission . '
@@ -90,10 +91,11 @@ private function getQueueTable($data) {
$table = '
<table class="default">
<tr>
<th style="width: 3rem;">#</th>
<th style="width: 3.5rem;">#</th>
<th style="width: 10rem;">Потребител</th>
<th style="width: 10rem;">Задача</th>
<th style="width: 4.5rem;">Час</th>
<th style="width: 4.0rem;">Език</th>
<th style="width: 4.5rem;">Прогрес</th>
<th>Статус</th>
' . $adminExtras . '

0 comments on commit 0609348

Please sign in to comment.
You can’t perform that action at this time.