summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--TODO3
-rw-r--r--db/create.sql1
-rw-r--r--db/models.py4
-rw-r--r--scripts/sqlite_to_pg.py2
4 files changed, 3 insertions, 7 deletions
diff --git a/TODO b/TODO
index ee56361..da6cf42 100644
--- a/TODO
+++ b/TODO
@@ -3,6 +3,3 @@ Database
- drop 'name' column from problem / problem_group / language tables and move
values to corresponding {en,sl}.py files
-- drop 'is_visible' column from problem table (or 'visible' attribute from
- common.py files)
-- maybe: drop 'group' attribute from common.py files?
diff --git a/db/create.sql b/db/create.sql
index 57c3647..bb7ee35 100644
--- a/db/create.sql
+++ b/db/create.sql
@@ -68,7 +68,6 @@ create table problem (
problem_group_id integer not null,
name varchar(100) not null,
identifier varchar(100) not null,
- is_visible bool not null default true,
constraint problem_pk primary key (id),
constraint problem_fk1 foreign key (language_id) references language (id) on delete no action on update cascade,
constraint problem_fk2 foreign key (problem_group_id) references problem_group (id) on delete no action on update cascade,
diff --git a/db/models.py b/db/models.py
index 4eda2ba..b8d64a1 100644
--- a/db/models.py
+++ b/db/models.py
@@ -27,8 +27,8 @@ class CodeqUser(collections.namedtuple('CodeqUser', ['id', 'username', 'password
def solved_problems(user_id, language):
return _run_sql('select g.identifier, p.identifier from solution s inner join problem p on p.id = s.problem_id inner join problem_group g on g.id = p.problem_group_id inner join language l on l.id = p.language_id where s.codeq_user_id = %s and l.identifier = %s and s.done = True', (user_id, language), fetch_one=False)
-class Problem(collections.namedtuple('Problem', ['id', 'language_id', 'problem_group_id', 'name', 'identifier', 'is_visible'])):
- __sql_prefix = 'select id, language_id, problem_group_id, name, identifier, is_visible from problem'
+class Problem(collections.namedtuple('Problem', ['id', 'language_id', 'problem_group_id', 'name', 'identifier'])):
+ __sql_prefix = 'select id, language_id, problem_group_id, name, identifier from problem'
@staticmethod
def get(**kwargs):
diff --git a/scripts/sqlite_to_pg.py b/scripts/sqlite_to_pg.py
index a5889d6..29e1317 100644
--- a/scripts/sqlite_to_pg.py
+++ b/scripts/sqlite_to_pg.py
@@ -176,7 +176,7 @@ if __name__ == '__main__':
log('Copying tutor_problem -> problem')
copy_table(
'select id, group_id, name, visible from tutor_problem',
- 'insert into problem (id, language_id, problem_group_id, name, is_visible, identifier) values (%s, ' + str(_language_prolog_id) + ', %s, %s, %s, %s)',
+ 'insert into problem (id, language_id, problem_group_id, name, identifier) values (%s, ' + str(_language_prolog_id) + ', %s, %s, %s)',
convert_problem, None, 'problem_id_seq')
log('Copying tutor_attempt -> solution')