[Plugin] Schedule: Allow retraction of service
This commit is contained in:
parent
ed361a7361
commit
e7efa53071
|
@ -169,9 +169,14 @@ def delete_job(job: Job):
|
||||||
|
|
||||||
def assign_to_job(job: Job, user, value):
|
def assign_to_job(job: Job, user, value):
|
||||||
service = Service.query.get((job.id, user._id))
|
service = Service.query.get((job.id, user._id))
|
||||||
if service:
|
if value < 0:
|
||||||
service.value = value
|
if not service:
|
||||||
|
raise BadRequest
|
||||||
|
db.session.delete(service)
|
||||||
else:
|
else:
|
||||||
service = Service(user_=user, value=value, job_=job)
|
if service:
|
||||||
db.session.add(service)
|
service.value = value
|
||||||
|
else:
|
||||||
|
service = Service(user_=user, value=value, job_=job)
|
||||||
|
db.session.add(service)
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
|
Loading…
Reference in New Issue