• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

zestedesavoir / zds-site / 11039742153

25 Sep 2024 07:23PM UTC coverage: 88.938%. Remained the same
11039742153

push

github

web-flow
Correction de l'erreur 422 de Coveralls (#6646)

4738 of 5930 branches covered (79.9%)

16740 of 18822 relevant lines covered (88.94%)

1.89 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/zds/notification/management/commands/fix_persistent_notifications.py
1
from django.core.management import BaseCommand
×
2
from django.contrib.contenttypes.models import ContentType
×
3

4
from zds.notification.models import Notification
×
5
from zds.forum.models import Topic
×
6

7

8
class Command(BaseCommand):
×
9
    help = "Fix all persistent notifications."
×
10

11
    def handle(self, *args, **options):
×
12
        content_type = ContentType.objects.get_for_model(Topic)
×
13
        notifications = Notification.objects.filter(content_type=content_type, is_read=False).all()
×
14
        count = 0
×
15
        print("")
×
16
        for notification in notifications:
×
17
            if notification.subscription.content_object != notification.content_object.forum:
×
18
                notification.is_read = True
×
19
                notification.is_dead = True
×
20
                notification.save()
×
21
                print(notification)
×
22
                count += 1
×
23
        print(f"{count} notifications have been fixed")
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc