forked from MarseyWorld/MarseyWorld
testing, pls ignore
parent
8c3989e98a
commit
bc41bb5584
|
@ -8,7 +8,7 @@ import files.helpers.stats as stats
|
||||||
import files.helpers.awards as awards
|
import files.helpers.awards as awards
|
||||||
import files.routes.static as route_static
|
import files.routes.static as route_static
|
||||||
from files.routes.subs import sub_inactive_purge_task
|
from files.routes.subs import sub_inactive_purge_task
|
||||||
from files.routes.admin import give_monthly_marseybux_task
|
from files.routes.admin import give_monthly_marseybux_task, migrate_polls
|
||||||
|
|
||||||
from sys import stdout
|
from sys import stdout
|
||||||
|
|
||||||
|
@ -33,7 +33,8 @@ def cron(every_5m, every_1h, every_1d, every_1mo):
|
||||||
sub_inactive_purge_task()
|
sub_inactive_purge_task()
|
||||||
|
|
||||||
if every_1mo:
|
if every_1mo:
|
||||||
give_monthly_marseybux_task()
|
#give_monthly_marseybux_task()
|
||||||
|
migrate_polls()
|
||||||
|
|
||||||
g.db.commit()
|
g.db.commit()
|
||||||
g.db.close()
|
g.db.close()
|
||||||
|
|
|
@ -50,6 +50,31 @@ def give_monthly_marseybux_task():
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
def migrate_polls():
|
||||||
|
|
||||||
|
polls = g.db.query(Comment).filter_by(author_id=6176, parent_comment_id=None, parent_submission=77232).all()
|
||||||
|
for c in polls:
|
||||||
|
print(c.id, flush=True)
|
||||||
|
option = SubmissionOption(
|
||||||
|
submission_id=c.parent_submission,
|
||||||
|
body_html=c.body_html,
|
||||||
|
exclusive = False
|
||||||
|
)
|
||||||
|
g.db.add(option)
|
||||||
|
g.db.flush()
|
||||||
|
votes = g.db.query(CommentVote).filter_by(comment_id=c.id).all()
|
||||||
|
for vote in votes:
|
||||||
|
o_vote = SubmissionOptionVote(
|
||||||
|
option_id=option.id,
|
||||||
|
user_id=vote.user_id,
|
||||||
|
submission_id=c.parent_submission,
|
||||||
|
)
|
||||||
|
g.db.add(o_vote)
|
||||||
|
g.db.delete(vote)
|
||||||
|
g.db.delete(c)
|
||||||
|
|
||||||
|
g.db.commit()
|
||||||
|
|
||||||
@app.post('/kippy')
|
@app.post('/kippy')
|
||||||
@admin_level_required(3)
|
@admin_level_required(3)
|
||||||
def kippy(v):
|
def kippy(v):
|
||||||
|
|
Loading…
Reference in New Issue