reaction-cudl-log
This commit is contained in:
parent
2c1bfaf0fe
commit
7199539a28
|
@ -185,8 +185,8 @@ def prepare_new_rating(reaction: dict, shout_id: int, session, author: Author):
|
|||
@mutation.field('create_reaction')
|
||||
@login_required
|
||||
async def create_reaction(_, info, reaction):
|
||||
user_id = info.context['user_id']
|
||||
|
||||
logger.debug(f'{info.context} for {reaction}')
|
||||
user_id = info.context.get('user_id')
|
||||
shout_id = reaction.get('shout')
|
||||
|
||||
if not shout_id:
|
||||
|
@ -231,6 +231,7 @@ async def create_reaction(_, info, reaction):
|
|||
@mutation.field('update_reaction')
|
||||
@login_required
|
||||
async def update_reaction(_, info, reaction):
|
||||
logger.debug(f'{info.context} for {reaction}')
|
||||
user_id = info.context.get('user_id')
|
||||
roles = info.context.get('roles')
|
||||
rid = reaction.get('id')
|
||||
|
@ -289,6 +290,7 @@ async def update_reaction(_, info, reaction):
|
|||
@mutation.field('delete_reaction')
|
||||
@login_required
|
||||
async def delete_reaction(_, info, reaction_id: int):
|
||||
logger.debug(f'{info.context} for {reaction_id}')
|
||||
user_id = info.context.get('user_id')
|
||||
roles = info.context.get('roles', [])
|
||||
if user_id:
|
||||
|
|
|
@ -192,13 +192,16 @@ def get_with_stat(q):
|
|||
with local_session() as session:
|
||||
for cols in session.execute(q):
|
||||
entity = cols[0]
|
||||
entity.stat = {'shouts': cols[1], 'authors': cols[2], 'followers': cols[3]}
|
||||
entity.stat = {}
|
||||
entity.stat['shouts'] = cols[1]
|
||||
entity.stat['authors'] = cols[2]
|
||||
entity.stat['followers'] = cols[3]
|
||||
entity.stat['comments'] = cols[4]
|
||||
if is_author:
|
||||
entity.stat['comments'] = cols[4]
|
||||
entity.stat['topics'] = cols[5]
|
||||
# entity.stat['rating'] = cols[5] - cols[6]
|
||||
# entity.stat['rating_shouts'] = cols[7] - cols[8]
|
||||
pass
|
||||
|
||||
records.append(entity)
|
||||
|
||||
return records
|
||||
|
|
Loading…
Reference in New Issue
Block a user