#!/usr/bin/perl

use strict;
use warnings;

use Data::Dumper;
use List::Util qw(shuffle);
use Sys::RunAlone;

use Ernad::Learn;
use Ernad::Notify;

my $impna = $ARGV[0] // die "no impna";
my $l=Ernad::Learn->new({'impna' => $impna,
                         'verbose' => 1});

## required for the email software
our $e=$l->{'e'};
foreach my $repcode (shuffle $e->list_repcodes()) {
  if($e->{'r'}) {
    $e->{'r'}->load($repcode);
  }
  my $ps_rif=$l->presort_ahead($repcode) or next;
  &Ernad::Notify::notify($e,$ps_rif);
}

__END__;
