Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove double serialization of the jobs field #41

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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