Skip to content

Commit

Permalink
Transform replace json.dumps with ProtoHelper.to_json in DbPogoProtoS…
Browse files Browse the repository at this point in the history
…ubmitRaw.py
  • Loading branch information
Grennith committed Feb 18, 2024
1 parent 10cf0de commit dec82e0
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions mapadroid/db/DbPogoProtoSubmitRaw.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@

import sqlalchemy
from bitstring import BitArray
from google.protobuf.internal.containers import RepeatedCompositeFieldContainer, RepeatedScalarFieldContainer
from google.protobuf.internal.containers import (
RepeatedCompositeFieldContainer, RepeatedScalarFieldContainer)
from redis import Redis
from sqlalchemy.exc import IntegrityError
from sqlalchemy.ext.asyncio import AsyncSession

import mapadroid.mitm_receiver.protos.Rpc_pb2 as pogoprotos
from mapadroid.db.helper.GymDetailHelper import GymDetailHelper
from mapadroid.db.helper.GymHelper import GymHelper
from mapadroid.db.helper.PokemonDisplayHelper import PokemonDisplayHelper
Expand Down Expand Up @@ -44,10 +46,9 @@
REDIS_CACHETIME_ROUTE,
REDIS_CACHETIME_STOP_DETAILS,
REDIS_CACHETIME_WEATHER)
from mapadroid.utils.madGlobals import MonSeenTypes, QuestLayer, MadGlobals
from mapadroid.utils.madGlobals import MadGlobals, MonSeenTypes, QuestLayer
from mapadroid.utils.questGen import QuestGen
from mapadroid.utils.s2Helper import S2Helper
import mapadroid.mitm_receiver.protos.Rpc_pb2 as pogoprotos

logger = get_logger(LoggerEnums.database)

Expand Down Expand Up @@ -712,8 +713,7 @@ async def quest(self, session: AsyncSession, quest_proto: pogoprotos.FortSearchO
target: Optional[int] = goal.target
condition: RepeatedCompositeFieldContainer[pogoprotos.QuestConditionProto] = goal.condition

# TODO: Json dumping protos...
json_condition: str = json.dumps(condition)
json_condition: str = ProtoHelper.to_json(condition)
task = await quest_gen.questtask(int(quest_type), json_condition, int(target), quest_template,
quest_title_resource_id)
quest: Optional[TrsQuest] = await TrsQuestHelper.get(session, fort_id, quest_layer)
Expand All @@ -732,7 +732,7 @@ async def quest(self, session: AsyncSession, quest_proto: pogoprotos.FortSearchO
quest.quest_item_amount = item_amount
quest.quest_target = target
quest.quest_condition = json_condition
quest.quest_reward = json.dumps(rewards)
quest.quest_reward = ProtoHelper.to_json(rewards)
quest.quest_task = task
quest.quest_template = quest_template
quest.quest_title = quest_title_resource_id
Expand Down

0 comments on commit dec82e0

Please sign in to comment.