|
@@ -175,7 +175,9 @@ class EmComponent(object):
|
175
|
175
|
dbe = cls.db_engine()
|
176
|
176
|
conn = dbe.connect()
|
177
|
177
|
|
178
|
|
- kwargs['rank'] = -1 # Warning !!!
|
|
178
|
+
|
|
179
|
+ kwargs['rank'] = get_max_rank() + 1 #Warning !!!
|
|
180
|
+
|
179
|
181
|
|
180
|
182
|
table = sql.Table(cls.table, sqlutils.meta(dbe))
|
181
|
183
|
req = table.insert(kwargs)
|
|
@@ -313,6 +315,7 @@ class EmComponent(object):
|
313
|
315
|
logger.error("Bad argument")
|
314
|
316
|
raise ValueError('new_rank to big, new_rank - 1 doesn\'t exist. new_rank = ' + str((new_rank)))
|
315
|
317
|
elif (sign == '+' and self.rank + new_rank <= self.get_max_rank()):
|
|
318
|
+
|
316
|
319
|
req = sql.sql.select([component.c.uid, component.c.rank])
|
317
|
320
|
req = req.where((getattr(component.c, self.ranked_in) == getattr(self, self.ranked_in)) & (component.c.rank == self.rank + new_rank))
|
318
|
321
|
conn = dbe.connect()
|