|
@@ -170,6 +170,9 @@ class EmComponent(object):
|
170
|
170
|
res = c.execute(req)
|
171
|
171
|
res = res.fetchone()
|
172
|
172
|
c.close()
|
|
173
|
+
|
|
174
|
+ req = sql.sql.select([component.c.uid, component.c.rank])
|
|
175
|
+
|
173
|
176
|
if(res != None):
|
174
|
177
|
if(new_rank < self.rank):
|
175
|
178
|
req = req.where((getattr(component.c, self.ranked_in) == getattr(self, self.ranked_in)) & ( component.c.rank >= new_rank) & (component.c.rank < self.rank))
|
|
@@ -183,11 +186,10 @@ class EmComponent(object):
|
183
|
186
|
vals = list()
|
184
|
187
|
vals.append({'id' : self.id, 'rank' : new_rank})
|
185
|
188
|
|
186
|
|
- if(new_rank < self.rank):
|
187
|
|
- for row in res:
|
|
189
|
+ for row in res:
|
|
190
|
+ if(new_rank < self.rank):
|
188
|
191
|
vals.append({'id' : row.uid, 'rank' : row.rank+1})
|
189
|
|
- else:
|
190
|
|
- for row in res:
|
|
192
|
+ else:
|
191
|
193
|
vals.append({'id' : row.uid, 'rank' : row.rank-1})
|
192
|
194
|
|
193
|
195
|
|
|
@@ -196,7 +198,6 @@ class EmComponent(object):
|
196
|
198
|
c.close()
|
197
|
199
|
|
198
|
200
|
self.rank = new_rank
|
199
|
|
- self.save()
|
200
|
201
|
else:
|
201
|
202
|
logger.error("Bad argument")
|
202
|
203
|
raise ValueError('new_rank to big, new_rank - 1 doesn\'t exist. new_rank = '+str((new_rank)))
|
|
@@ -219,7 +220,6 @@ class EmComponent(object):
|
219
|
220
|
c.close()
|
220
|
221
|
|
221
|
222
|
self.rank += new_rank
|
222
|
|
- self.save()
|
223
|
223
|
else:
|
224
|
224
|
logger.error("Bad argument")
|
225
|
225
|
raise ValueError('Excepted a positive int not a null. new_rank = '+str((new_rank)))
|
|
@@ -242,7 +242,6 @@ class EmComponent(object):
|
242
|
242
|
c.close()
|
243
|
243
|
|
244
|
244
|
self.rank -= new_rank
|
245
|
|
- self.save()
|
246
|
245
|
else:
|
247
|
246
|
logger.error("Bad argument")
|
248
|
247
|
raise ValueError('Excepted a positive int not a null. new_rank = '+str((new_rank)))
|