Skip to content

Commit

Permalink
Remove double serialization of the jobs field
Browse files Browse the repository at this point in the history
  • Loading branch information
polina-popova committed Jun 7, 2019
1 parent f33add6 commit 82c4dd0
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions server/huntflow_reloaded/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ async def handle_calendar_event(self): # pylint: disable=too-many-locals
message_type = 'rescheduled-interview'

if interview.jobs:
jobs_to_be_deleted = json_decode(interview.jobs)
jobs_to_be_deleted = interview.jobs

for job_id in jobs_to_be_deleted:
self._scheduler.remove_job(job_id)
Expand Down Expand Up @@ -472,7 +472,7 @@ async def post(self): # pylint: disable=arguments-differ

if interview and interview.start > datetime.now():
if interview.jobs:
jobs_to_be_deleted = json_decode(interview.jobs)
jobs_to_be_deleted = interview.jobs

for job_id in jobs_to_be_deleted:
self._scheduler.remove_job(job_id)
Expand Down
2 changes: 1 addition & 1 deletion server/huntflow_reloaded/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ async def schedule_interview(self, context):
job = self.add(date=scheduled_date, func=self._notify_interview, args=args)
jobs.append(job.id)

await interview.update(jobs=json.dumps(jobs)).apply()
await interview.update(jobs=jobs).apply()

async def remove_candidate(self, context):
"""Removes the candidate in a day after first working day at midnight. """
Expand Down
2 changes: 1 addition & 1 deletion server/test/runtests.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ def test_employment_date(self):
interview = self.conn.execute(s).fetchall()
self.assertEqual(len(interview), 1)

jobs_id = json.loads(interview[0].jobs)
jobs_id = interview[0].jobs

# Mocking of expired jobs
for job_id in jobs_id:
Expand Down

0 comments on commit 82c4dd0

Please sign in to comment.