This commit is contained in:
TLINDEN
2012-02-10 20:31:48 +01:00
parent b2b5cea5ec
commit 8779f24249
3 changed files with 428 additions and 43 deletions

View File

@@ -4,7 +4,7 @@
package NOTEDB::text;
$NOTEDB::text::VERSION = "1.01";
$NOTEDB::text::VERSION = "1.03";
use strict;
#use Data::Dumper;
@@ -121,16 +121,22 @@ sub get_nextnum {
my($num, $te, $me, $buffer);
if ($this->unchanged) {
$num = 1;
foreach (keys %{$this->{cache}}) {
$num++;
}
return $num;
my @numbers = sort { $a <=> $b } keys %{$this->{cache}};
$num = pop @numbers;
$num++;
#$num = 1;
#foreach (keys %{$this->{cache}}) {
# $num++;
#}
return $num;
}
my %data = $this->get_all();
my $size = scalar keys %data;
$num = $size + 1;
my @numbers = sort { $a <=> $b } keys %data;
$num = pop @numbers;
$num++;
#my $size = scalar keys %data;
#$num = $size + 1;
return $num;
}
@@ -219,24 +225,7 @@ sub set_del {
}
sub set_recountnums {
my($this) = @_;
my(%orig, %data, $note, $date, $T, $setnum, $buffer, $n, $N, $t);
$setnum = 1;
%orig = $this->_retrieve();
foreach $N (sort {$a <=> $b} keys %orig) {
$data{$setnum} = {
note => $orig{$N}->{note},
date => $orig{$N}->{date}
};
$setnum++;
}
$this->_store(\%data);
$this->changed;
# not required here
return;
}