Skip to content

Commit

Permalink
Merge branch 'master' into django4
Browse files Browse the repository at this point in the history
  • Loading branch information
digitalfox committed Aug 4, 2023
2 parents 6bbfedf + bf1a609 commit e13f1c6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions bot/pydici_bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,10 @@ async def alert_consultant(context):
tasks = await db_sync_to_async(consultant.get_tasks)()
if tasks:
cache.set(cache_key, 1, 3600 * 12) # Keep track 12 hours that this user has been alerted
task_name, task_count, task_link, task_priority = random.choice(tasks)
url = await db_sync_to_async(get_parameter)("HOST") + task_link
msg = _("Hey, what about thinking about that: %(task_name)s (x%(task_count)s)\n%(link)s") % {"task_name": task_name,
"task_count": task_count,
task = random.choice(tasks)
url = await db_sync_to_async(get_parameter)("HOST") + task.link
msg = _("Hey, what about thinking about that: %(task_name)s (x%(task_count)s)\n%(link)s") % {"task_name": task.label,
"task_count": task.count,
"link": url.replace(" ", "%20")}
try:
await context.bot.send_message(chat_id=consultant.telegram_id, text=msg)
Expand Down
4 changes: 2 additions & 2 deletions people/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,15 @@ def compute_consultant_tasks(consultant_id):
link=reverse("staffing:mission_home", args=[random.choice(missions_without_billing_mode).id]), priority=3))

# Missions with missing financial conditions
missions_with_missing_fc = [ m for m in Mission.objects.filter(active=True, responsible=consultant) if not m.defined_rates()]
missions_with_missing_fc = [ m for m in Mission.objects.filter(active=True, nature="PROD", responsible=consultant) if not m.defined_rates()]
missions_with_missing_fc_count = len(missions_with_missing_fc)
if missions_with_missing_fc_count > 0:
tasks.append(ConsultantTask(label=_("Consultants rates are not fully defined"), count=missions_with_missing_fc_count,
category=_("missions"), priority=3,
link=reverse("staffing:mission_home", args=[random.choice(missions_with_missing_fc).id])))

# Mission with missing marketing product
missions_with_missing_mktg_pdt = Mission.objects.filter(active=True, responsible=consultant, marketing_product__isnull=True)
missions_with_missing_mktg_pdt = Mission.objects.filter(active=True, nature="PROD", responsible=consultant, marketing_product__isnull=True)
missions_with_missing_mktg_pdt_count = missions_with_missing_mktg_pdt.count()
if missions_with_missing_mktg_pdt_count > 0:
tasks.append(ConsultantTask(label=_("Mission marketing product is missing"), count=missions_with_missing_mktg_pdt_count,
Expand Down
2 changes: 1 addition & 1 deletion staffing/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1580,7 +1580,7 @@ def rates_report(request):
step = request.GET.get("step", "year")
if step == "month":
month = date.today().replace(day=1)
for i in range(1, 12):
for i in range(1, 13):
periods.append(((month - timedelta(30*i)).replace(day=1), (month - timedelta(30*(i-1))).replace(day=1)))
else:
fiscal_year_month = int(get_parameter("FISCAL_YEAR_MONTH"))
Expand Down

0 comments on commit e13f1c6

Please sign in to comment.