Skip to content

Commit

Permalink
Better moderation reminders.
Browse files Browse the repository at this point in the history
  • Loading branch information
facundobatista committed Jan 25, 2024
1 parent f73c093 commit 87ae71d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion joboffers/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@

OFFER_EXPIRATION_DAYS = 180

PENDING_MODERATION_OFFER_DAYS = 2
PENDING_MODERATION_OFFER_DAYS = 0

TELEGRAM_MODERATION_MESSAGE = _('La oferta {offer_url} necesita ser moderada.')
TELEGRAM_APPROVED_MESSAGE = _('La oferta {offer_url} fue aprobada por {username}.')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ def notify_pending_moderation_offers():
"""
expiration_date = timezone.now() - timedelta(days=PENDING_MODERATION_OFFER_DAYS)
joboffers = JobOffer.objects.filter(
state=OfferState.MODERATION, modified_at__lte=expiration_date
state=OfferState.MODERATION, modified_at__lte=expiration_date
)

for joboffer in joboffers:
message = TELEGRAM_PENDING_MODERATION_MESSAGE.format(
offer_url=joboffer.get_absolute_url(),
moderation_reminder_days=PENDING_MODERATION_OFFER_DAYS
offer_url=joboffer.get_full_url(),
moderation_reminder_days=PENDING_MODERATION_OFFER_DAYS
)

send_notification_to_moderators(message)
Expand All @@ -38,9 +38,8 @@ def handle(self, *args, **options):
offers_notifed = notify_pending_moderation_offers()

self.stdout.write(
self.style.SUCCESS(
_('Se enviaron {offers_notified} recordatorios de moderación.').format(
offers_notified=offers_notifed
self.style.SUCCESS(
_('Se enviaron {offers_notified} recordatorios de moderación.').format(
offers_notified=offers_notifed)
)
)
)

0 comments on commit 87ae71d

Please sign in to comment.