MCPcopy Create free account
hub / github.com/diffgram/diffgram / send_to_review_randomly

Function send_to_review_randomly

shared/utils/task/task_complete.py:56–79  ·  view source on GitHub ↗

Generates a random number and sends task to review based on the Job review chances. :param task: :return:

(session, task, task_update_manager)

Source from the content-addressed store, hash-verified

54
55
56def send_to_review_randomly(session, task, task_update_manager):
57 """
58 Generates a random number and sends task to review based on the Job review
59 chances.
60 :param task:
61 :return:
62 """
63 # Review chance is a number betwen 0-1
64 review_chance = task.job.review_chance
65 rand_num = random.uniform(0, 1)
66
67 if rand_num <= review_chance:
68 # In review Mode no sync event (unless post_review=True)
69 task_update_manager.status = TASK_STATUSES['review_requested']
70 task_update_manager.main()
71 task_assign_reviewer.auto_assign_reviewer_to_task(
72 session = session,
73 task = task
74 )
75 return False
76 else:
77 task_update_manager.status = TASK_STATUSES['complete']
78 task_update_manager.main()
79 return True
80
81def task_complete(session,
82 task,

Callers 1

task_completeFunction · 0.85

Calls 1

mainMethod · 0.45

Tested by

no test coverage detected