Compare commits
2 commits
e05f7bd8ef
...
5050f18a2f
Author | SHA1 | Date | |
---|---|---|---|
|
5050f18a2f | ||
|
5b7351efe0 |
2 changed files with 30 additions and 8 deletions
|
@ -5,13 +5,13 @@ import "time"
|
|||
type Result int32
|
||||
|
||||
const (
|
||||
Testing Result = 0
|
||||
NotTested Result = 1
|
||||
SystemFailDuringTesting Result = 2
|
||||
TimeLimitExceeded Result = 3
|
||||
MemoryLimitExceeded Result = 4
|
||||
CompilationError Result = 5
|
||||
Accepted Result = 6
|
||||
NotTested Result = 0 // change only with schema change
|
||||
Accepted Result = 1
|
||||
CompilationError Result = 2
|
||||
MemoryLimitExceeded Result = 3
|
||||
TimeLimitExceeded Result = 4
|
||||
SystemFailDuringTesting Result = 5
|
||||
Testing Result = 6
|
||||
)
|
||||
|
||||
func (result Result) Valid() error {
|
||||
|
|
|
@ -238,7 +238,26 @@ END; $$ LANGUAGE plpgsql;
|
|||
CREATE TRIGGER new_subtask_trg AFTER INSERT ON subtasks FOR EACH ROW EXECUTE FUNCTION on_new_subtask();
|
||||
|
||||
|
||||
CREATE FUNCTION on_new_solution() RETURNS TRIGGER
|
||||
LANGUAGE plpgsql AS $$
|
||||
BEGIN
|
||||
INSERT INTO subtaskruns (subtask_id,solution_id,result,score) (SELECT id,NEW.id,0,0 FROM subtasks WHERE task_id = NEW.task_id);
|
||||
--INSERT INTO testruns (test_id,subtaskrun_id,result) (SELECT id,str.id,0 FROM tests WHERE testgroup_id IN (SELECT testgroup_id FROM subtasks WHERE id IN (SELECT subtask_id FROM subtaskruns AS str WHERE solution_id=NEW.id)));
|
||||
RETURN NEW;
|
||||
END;
|
||||
$$;
|
||||
|
||||
CREATE TRIGGER on_new_solution_trg AFTER INSERT ON solutions FOR EACH ROW EXECUTE FUNCTION on_new_solution();
|
||||
|
||||
CREATE FUNCTION on_new_subtaskrun() RETURNS TRIGGER
|
||||
LANGUAGE plpgsql AS $$
|
||||
BEGIN
|
||||
INSERT INTO testruns (test_id,subtaskrun_id,result) (SELECT id,NEW.id,0 FROM tests WHERE testgroup_id IN (SELECT testgroup_id FROM subtasks WHERE id=NEW.subtask_id));
|
||||
RETURN NEW;
|
||||
END;
|
||||
$$;
|
||||
|
||||
CREATE TRIGGER on_new_subtaskrun_trg AFTER INSERT ON subtaskruns FOR EACH ROW EXECUTE FUNCTION on_new_subtaskrun();
|
||||
|
||||
CREATE FUNCTION updated_at_update() RETURNS TRIGGER
|
||||
LANGUAGE plpgsql AS
|
||||
|
@ -249,6 +268,7 @@ BEGIN
|
|||
END;
|
||||
$$;
|
||||
|
||||
|
||||
CREATE TRIGGER languages_upd_trg BEFORE UPDATE ON languages FOR EACH ROW EXECUTE FUNCTION updated_at_update();
|
||||
CREATE TRIGGER problems_upd_trg BEFORE UPDATE ON problems FOR EACH ROW EXECUTE FUNCTION updated_at_update();
|
||||
CREATE TRIGGER contests_upd_trg BEFORE UPDATE ON contests FOR EACH ROW EXECUTE FUNCTION updated_at_update();
|
||||
|
@ -260,6 +280,8 @@ DROP FUNCTION IF EXISTS updated_at_update CASCADE;
|
|||
DROP FUNCTION IF EXISTS on_new_participant CASCADE;
|
||||
DROP FUNCTION IF EXISTS on_new_task CASCADE;
|
||||
DROP FUNCTION IF EXISTS on_new_subtask CASCADE;
|
||||
DROP FUNCTION IF EXISTS on_new_solution CASCADE;
|
||||
DROP FUNCTION IF EXISTS on_new_subtaskrun CASCADE;
|
||||
DROP TABLE IF EXISTS tests CASCADE;
|
||||
DROP TABLE IF EXISTS solutions CASCADE;
|
||||
DROP TABLE IF EXISTS languages CASCADE;
|
||||
|
|
Loading…
Reference in a new issue