fdfd
This commit is contained in:
parent
7e6f95a5af
commit
ad31b88d73
2 changed files with 16 additions and 6 deletions
|
@ -423,15 +423,13 @@ class User(Base, Stndrd, Age_times):
|
||||||
User.id != self.id
|
User.id != self.id
|
||||||
).order_by(User.username.asc()).all()
|
).order_by(User.username.asc()).all()
|
||||||
|
|
||||||
|
data = [x for x in data]
|
||||||
output = []
|
output = []
|
||||||
for x in data:
|
for x in data:
|
||||||
user = x[0]
|
user = x[0]
|
||||||
user._is_manual = x[1].is_manual
|
user._is_manual = x[1].is_manual
|
||||||
output.append(user)
|
output.append(user)
|
||||||
|
|
||||||
for alt in output:
|
|
||||||
output += alt.alts
|
|
||||||
|
|
||||||
return output
|
return output
|
||||||
|
|
||||||
def alts_threaded(self, db):
|
def alts_threaded(self, db):
|
||||||
|
|
|
@ -40,10 +40,22 @@ def check_for_alts(current_id):
|
||||||
if not check1 and not check2:
|
if not check1 and not check2:
|
||||||
|
|
||||||
try:
|
try:
|
||||||
new_alt = Alt(user1=past_id,
|
new_alt = Alt(user1=past_id, user2=current_id)
|
||||||
user2=current_id)
|
|
||||||
g.db.add(new_alt)
|
g.db.add(new_alt)
|
||||||
|
otheralts = g.db.query(Alt).filter(or_(Alt.user1 == past_id, Alt.user2 == past_id, Alt.user1 == current_id, Alt.user2 == current_id)).all()
|
||||||
|
print(otheralts)
|
||||||
|
for a in otheralts:
|
||||||
|
try:
|
||||||
|
new_alt = Alt(user1=a.user1, user2=past_id)
|
||||||
|
g.db.add(new_alt)
|
||||||
|
g.db.flush()
|
||||||
|
new_alt = Alt(user1=a.user1, user2=current_id)
|
||||||
|
g.db.add(new_alt)
|
||||||
|
g.db.flush()
|
||||||
|
except Exception as e:
|
||||||
|
g.db.rollback()
|
||||||
|
print(e)
|
||||||
|
continue
|
||||||
except BaseException:
|
except BaseException:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue