groupConf() takes gcid, not gid

This commit is contained in:
Damien Elmes 2011-03-29 18:29:20 +09:00
parent 692fba2ea3
commit 11f3de525f
2 changed files with 5 additions and 9 deletions

View file

@ -568,12 +568,6 @@ update facts set tags = :t, mod = :n where id = :id""", [fix(row) for row in res
def delGroup(self, gid): def delGroup(self, gid):
self.db.scalar("delete from groups where id = ?", gid) self.db.scalar("delete from groups where id = ?", gid)
def groupConf(self, gid):
return simplejson.loads(
self.db.scalar("""
select conf from gconf where id = (select gcid from groups where id = ?)""",
gid))
def setGroup(self, cids, gid): def setGroup(self, cids, gid):
self.db.execute( self.db.execute(
"update cards set gid = ? where id in "+ids2str(cids), gid) "update cards set gid = ? where id in "+ids2str(cids), gid)
@ -585,6 +579,11 @@ select conf from gconf where id = (select gcid from groups where id = ?)""",
"Return [name, id]." "Return [name, id]."
return self.db.all("select name, id from gconf order by name") return self.db.all("select name, id from gconf order by name")
def groupConf(self, gcid):
return simplejson.loads(
self.db.scalar(
"select conf from gconf where id = ?", gcid))
# Tag-based selective study # Tag-based selective study
########################################################################## ##########################################################################

View file

@ -144,9 +144,6 @@ def test_groups():
deck.delGroup(2) deck.delGroup(2)
assert len(deck.groups()) == 1 assert len(deck.groups()) == 1
assert deck.groupId("another group") == 3 assert deck.groupId("another group") == 3
# the newly created group should have a default schedule
conf = deck.groupConf(3)
assert conf == deck.groupConf(1)
# by default, everything should be shown # by default, everything should be shown
assert not deck.qconf['groups'] assert not deck.qconf['groups']