mirror of
https://github.com/renbaoshuo/S2OJ.git
synced 2024-11-26 05:08:41 +00:00
chore(web): update definition of groups_assignments
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
892a56a881
commit
f044ab8ed7
@ -455,11 +455,10 @@ CREATE TABLE `groups` (
|
|||||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||||
/*!40101 SET character_set_client = utf8mb4 */;
|
/*!40101 SET character_set_client = utf8mb4 */;
|
||||||
CREATE TABLE `groups_assignments` (
|
CREATE TABLE `groups_assignments` (
|
||||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
|
||||||
`list_id` int(11) NOT NULL,
|
|
||||||
`group_id` int(11) NOT NULL,
|
`group_id` int(11) NOT NULL,
|
||||||
|
`list_id` int(11) NOT NULL,
|
||||||
`end_time` datetime NOT NULL,
|
`end_time` datetime NOT NULL,
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`group_id`, `list_id`)
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4;
|
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4;
|
||||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||||
|
|
||||||
|
@ -146,10 +146,10 @@ function queryGroupCurrentAC($group_id) {
|
|||||||
return DB::selectAll("select a.problem_id as problem_id, a.submitter as submitter, a.submission_id as submission_id, b.submit_time as submit_time, d.title as problem_title, b.submit_time as submit_time, e.realname as realname from best_ac_submissions a inner join submissions b on (a.submission_id = b.id) inner join groups_users c on (a.submitter = c.username and c.group_id = $group_id) inner join problems d on (a.problem_id = d.id and d.is_hidden = 0) inner join user_info e on (a.submitter = e.username) where b.submit_time > addtime(now(), '-360:00:00') order by b.submit_time desc limit 10", MYSQLI_ASSOC);
|
return DB::selectAll("select a.problem_id as problem_id, a.submitter as submitter, a.submission_id as submission_id, b.submit_time as submit_time, d.title as problem_title, b.submit_time as submit_time, e.realname as realname from best_ac_submissions a inner join submissions b on (a.submission_id = b.id) inner join groups_users c on (a.submitter = c.username and c.group_id = $group_id) inner join problems d on (a.problem_id = d.id and d.is_hidden = 0) inner join user_info e on (a.submitter = e.username) where b.submit_time > addtime(now(), '-360:00:00') order by b.submit_time desc limit 10", MYSQLI_ASSOC);
|
||||||
}
|
}
|
||||||
function queryGroupAssignments($group_id) {
|
function queryGroupAssignments($group_id) {
|
||||||
return DB::selectAll("select a.id as id, a.list_id as list_id, a.end_time as end_time, b.title from groups_assignments a left join lists b on a.list_id = b.id where a.group_id = $group_id order by a.end_time asc", MYSQLI_ASSOC);
|
return DB::selectAll("select a.list_id as list_id, a.end_time as end_time, b.title from groups_assignments a left join lists b on a.list_id = b.id where a.group_id = $group_id order by a.end_time asc", MYSQLI_ASSOC);
|
||||||
}
|
}
|
||||||
function queryGroupActiveAssignments($group_id) {
|
function queryGroupActiveAssignments($group_id) {
|
||||||
return DB::selectAll("select a.id as id, a.group_id as group_id, a.list_id as list_id, a.end_time as end_time, b.title from groups_assignments a left join lists b on a.list_id = b.id where a.group_id = $group_id and a.end_time >= addtime(now(), '-168:00:00') order by a.end_time asc", MYSQLI_ASSOC);
|
return DB::selectAll("select a.group_id as group_id, a.list_id as list_id, a.end_time as end_time, b.title from groups_assignments a left join lists b on a.list_id = b.id where a.group_id = $group_id and a.end_time >= addtime(now(), '-168:00:00') order by a.end_time asc", MYSQLI_ASSOC);
|
||||||
}
|
}
|
||||||
function queryAssignmentByGroupListID($group_id, $list_id) {
|
function queryAssignmentByGroupListID($group_id, $list_id) {
|
||||||
return DB::selectFirst("select * from groups_assignments where list_id='$list_id' and group_id='$group_id'", MYSQLI_ASSOC);
|
return DB::selectFirst("select * from groups_assignments where list_id='$list_id' and group_id='$group_id'", MYSQLI_ASSOC);
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
RENAME TABLE groups_assignments TO assignments;
|
RENAME TABLE groups_assignments TO assignments;
|
||||||
|
ALTER TABLE `assignments` ADD COLUMN `id` int(11) NOT NULL AUTO_INCREMENT;
|
||||||
|
ALTER TABLE `assignments` DROP PRIMARY KEY, ADD PRIMARY KEY (`id`);
|
||||||
ALTER TABLE `assignments` ADD COLUMN `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP;
|
ALTER TABLE `assignments` ADD COLUMN `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP;
|
||||||
ALTER TABLE `assignments` CHANGE COLUMN `end_time` `deadline` datetime NOT NULL;
|
ALTER TABLE `assignments` CHANGE COLUMN `end_time` `deadline` datetime NOT NULL;
|
||||||
ALTER TABLE `countdowns` CHANGE COLUMN `end_time` `endtime` datetime NOT NULL;
|
ALTER TABLE `countdowns` CHANGE COLUMN `end_time` `endtime` datetime NOT NULL;
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
RENAME TABLE assignments TO groups_assignments;
|
RENAME TABLE assignments TO groups_assignments;
|
||||||
|
ALTER TABLE `assignments` DROP PRIMARY KEY, ADD PRIMARY KEY (`group_id`, `list_id`);
|
||||||
|
ALTER TABLE `assignments` DROP COLUMN `id`;
|
||||||
ALTER TABLE `groups_assignments` DROP COLUMN `create_time`;
|
ALTER TABLE `groups_assignments` DROP COLUMN `create_time`;
|
||||||
ALTER TABLE `groups_assignments` CHANGE COLUMN `deadline` `end_time` datetime NOT NULL;
|
ALTER TABLE `groups_assignments` CHANGE COLUMN `deadline` `end_time` datetime NOT NULL;
|
||||||
ALTER TABLE `countdowns` CHANGE COLUMN `endtime` `end_time` datetime NOT NULL;
|
ALTER TABLE `countdowns` CHANGE COLUMN `endtime` `end_time` datetime NOT NULL;
|
||||||
|
Loading…
Reference in New Issue
Block a user