<commit_before>import {Component, OnInit} from '@angular/core'
import {NotificationService} from '../notification.service'
import {Notification} from '../../models/notification'

@Component({
  selector: 'wn-notification-popup-button',
  templateUrl: './notification-popup-button.component.html',
  styleUrls: ['./notification-popup-button.component.css']
})
export class NotificationPopupButtonComponent implements OnInit {

  notifications: Notification[] = []
  showNotifications = false
  loadedAllNotifications = false
  latestIndexLoaded = 0

  numberOfUnreadNotifications: number

  constructor(private _notificationService: NotificationService) {
  }

  ngOnInit() {
    const from = 0
    const to = 10
    this._notificationService.getLatestNotifications(from, to).subscribe(notifications => {
      this.notifications = notifications
      this.numberOfUnreadNotifications = this.notifications.filter(not => !not.read).length
      this.latestIndexLoaded = to
      this.loadedAllNotifications = notifications.length < to - from
    })

    this.subscribeToNewNotifications()
  }

  subscribeToNewNotifications() {
    this._notificationService.getContinousNewNotifications().subscribe(newNotifications => {
        if (newNotifications.length) {
          this.numberOfUnreadNotifications = newNotifications.length
          this.notifications = newNotifications.concat(this.notifications)
          this.latestIndexLoaded = this.notifications.length
        }
      }
    )
  }

  loadMoreNotifications() {
    this._notificationService.getLatestNotifications(this.latestIndexLoaded, this.latestIndexLoaded + 5).subscribe(not => {
      this.latestIndexLoaded += 5
      this.notifications = this.notifications.concat(not)
      this.loadedAllNotifications = this.latestIndexLoaded > this.notifications.length
      console.log(this.latestIndexLoaded)
      console.log(this.notifications.length)
    })
  }

  toggleShowNotifications() {
    this.showNotifications = !this.showNotifications
    this.numberOfUnreadNotifications = 0
    this.notifications.forEach(notification => {
      if (!notification.read) {
        this._notificationService.readNotification(notification)
        if (!this.showNotifications) {
          notification.read = true
        }
      }
    })
  }

}
<commit_msg>removed debug prints<commit_after>import {Component, OnInit} from '@angular/core'
import {NotificationService} from '../notification.service'
import {Notification} from '../../models/notification'

@Component({
  selector: 'wn-notification-popup-button',
  templateUrl: './notification-popup-button.component.html',
  styleUrls: ['./notification-popup-button.component.css']
})
export class NotificationPopupButtonComponent implements OnInit {

  notifications: Notification[] = []
  showNotifications = false
  loadedAllNotifications = false
  latestIndexLoaded = 0

  numberOfUnreadNotifications: number

  constructor(private _notificationService: NotificationService) {
  }

  ngOnInit() {
    const from = 0
    const to = 10
    this._notificationService.getLatestNotifications(from, to).subscribe(notifications => {
      this.notifications = notifications
      this.numberOfUnreadNotifications = this.notifications.filter(not => !not.read).length
      this.latestIndexLoaded = to
      this.loadedAllNotifications = notifications.length < to - from
    })

    this.subscribeToNewNotifications()
  }

  subscribeToNewNotifications() {
    this._notificationService.getContinousNewNotifications().subscribe(newNotifications => {
        if (newNotifications.length) {
          this.numberOfUnreadNotifications = newNotifications.length
          this.notifications = newNotifications.concat(this.notifications)
          this.latestIndexLoaded = this.notifications.length
        }
      }
    )
  }

  loadMoreNotifications() {
    this._notificationService.getLatestNotifications(this.latestIndexLoaded, this.latestIndexLoaded + 5).subscribe(not => {
      this.latestIndexLoaded += 5
      this.notifications = this.notifications.concat(not)
      this.loadedAllNotifications = this.latestIndexLoaded > this.notifications.length
    })
  }

  toggleShowNotifications() {
    this.showNotifications = !this.showNotifications
    this.numberOfUnreadNotifications = 0
    this.notifications.forEach(notification => {
      if (!notification.read) {
        this._notificationService.readNotification(notification)
        if (!this.showNotifications) {
          notification.read = true
        }
      }
    })
  }

}

{'fraction_non_alphanumeric': 0.10022026431718062, 'fraction_numerical': 0.0030837004405286344, 'mean_word_length': 3.78, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2278461', 'n_tokens_mistral': 1224, 'n_tokens_neox': 1188, 'n_words': 190}