From 9a6acf6c2be15865ff3112981135852e180ef738 Mon Sep 17 00:00:00 2001 From: Nicolas Vigier Date: Wed, 26 Jun 2013 11:02:02 +0000 Subject: next_id: sort IDs numerically --- NEWS | 2 ++ lib/MGA/Advisories.pm | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index b10aeb6..1c23a7a 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,5 @@ +- fix next free id assignement + Version 0.10 - add CVE links in references diff --git a/lib/MGA/Advisories.pm b/lib/MGA/Advisories.pm index 9ebe35e..64c128c 100644 --- a/lib/MGA/Advisories.pm +++ b/lib/MGA/Advisories.pm @@ -77,7 +77,7 @@ sub get_advisories_from_dir { sub next_id { my $prefix = shift; my $year = DateTime->now->year; - my $newid = (0, sort map { m/^$prefix-$year-(\d+)$/ ? int $1 : () } @_)[-1] + 1; + my $newid = (0, sort { $a <=> $b } map { m/^$prefix-$year-(\d+)$/ ? int $1 : () } @_)[-1] + 1; return sprintf("%s-%s-%.4d", $prefix, $year, $newid); } -- cgit v1.2.1