severity 693689 wishlist
thanks
On 19 November 2012 at 11:13, Nicola Chiapolini wrote:
| Package: beancounter
| Version: 0.8.10
| Severity: important
C'mon on now.
| Tags: upstream patch
|
| Dear Maintainer,
Dude: "Maintainer == Author". There is no need to use the BTS here.
|
| I just installed beancounter and started to play around with it. Looks
| very promising. However the lsportfolio and lspositions commands failed
I've been using it daily for over a dozen years.
| to do anything useful. (at least on my SQLite install)
| Investigating the source showed two problems
| 1) the default date was given in the wrong format
| 2) the returnvalue of execute() is not the number of rows
| The attached patch fixes the problem for both commands.
|
| (In addition the patch increases the spacing for two columns in lspositions.
| Should probably have created a seperate patch, sorry.)
|
| The depsum error is of course due to the fact that it checked my patched
| code.
|
| thanks a lot
| Nicola
|
| -- System Information:
| Debian Release: wheezy/sid
| APT prefers testing
| APT policy: (990, 'testing'), (500, 'unstable'), (1, 'experimental')
| Architecture: amd64 (x86_64)
|
| Kernel: Linux 3.2.0-4-amd64 (SMP w/4 CPU cores)
| Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
| Shell: /bin/sh linked to /bin/dash
|
| Versions of packages beancounter depends on:
| ii libdate-manip-perl 6.32-1
| ii libdbd-pg-perl 2.19.2-2
| ii libdbd-sqlite3-perl 1.37-1
| ii libdbi-perl 1.622-1
| ii libfinance-yahooquote-perl 0.24
| ii libstatistics-descriptive-perl 3.0603-1
| ii perl 5.14.2-15
| ii sqlite3 3.7.13-1
|
| beancounter recommends no packages.
|
| beancounter suggests no packages.
|
| -- no debconf information
|
| -- debsums errors found:
| debsums: changed file /usr/bin/beancounter (from beancounter package)
|
| ----------------------------------------------------------------------
| 611c611
| < $stmt = $stmt . qq{where date > '1970-01-01' };
| ---
| > $stmt = $stmt . qq{where date > '19700101' };
This is very likely to break the other platforms. Please check (I only use
Postgresql but keep MySQL around) before making willy-nilly changes.
I am not sure I will have time to look into this for quite some time. My Pg
installation is rocksolid and hasn't needed maintenance for years.
Dirk
| 623,634c623,631
| < my $rows = $sth->execute;
| < if ( defined($rows) and $rows > 0 ) {
| < # print the results
| < print "$tl\n\t\t\tPortfolio listing\n$fl\n";
| < printf "%-10.10s%8.8s%8.8s%12.12s%12.12s%12.12s%17.17s\n$fl\n",
| < "Symbol", "Shares", "FX", " Type", " Owner", " Cost", "
Date";
| < while (my @row_ary = $sth->fetchrow_array) {
| < my ($stock, $nb, $fx, $type, $owner, $cost, $date) = @row_ary;
| < printf "%-10.10s%8d%8s%12s%12s%12.2f%17s\n",
| < $stock, $nb, $fx, $type, $owner, $cost, $date;
| < }
| < print "$tl\n";
| ---
| > my $rows = $sth->execute() or die("Failed to retrive portfolio info");
| > # print the results
| > print "$tl\n\t\t\tPortfolio listing\n$fl\n";
| > printf "%-10.10s%8.8s%8.8s%12.12s%12.12s%12.12s%17.17s\n$fl\n",
| > "Symbol", "Shares", "FX", " Type", " Owner", " Cost", " Date";
| > while (my @row_ary = $sth->fetchrow_array) {
| > my ($stock, $nb, $fx, $type, $owner, $cost, $date) = @row_ary;
| > printf "%-10.10s%8d%8s%12s%12s%12.2f%17s\n",
| > $stock, $nb, $fx, $type, $owner, $cost, $date;
| 635a633
| > print "$tl\n";
| 658c656
| < $stmt = $stmt . qq{where p.date > '1970-01-01' };
| ---
| > $stmt = $stmt . qq{where p.date > '19700101' };
| 672c670
| < my $rows = $sth->execute;
| ---
| > my $rows = $sth->execute() or die("Failed to retrive portfolio info");
| 674,692c672,684
| < if ( defined($rows) and $rows > 0 ) {
| < # print the results
| < print "$tl\n\t\t\t\tPortfolio listing\n$fl\n";
| < printf "%-7.7s%7.7s%5.5s%8.8s%8.8s%8.8s%12.12s%8.8s%11s\n$fl\n",
| < "Symbol", "Shares", "FX", " Type", " Owner", " Cost", "
Date",
| < " Price", " Net";
| < my $sum = 0;
| < while (my @row_ary = $sth->fetchrow_array) {
| < my ($fxthen,$fxnow) = (1.0,1.0);
| < my ($stock, $nb, $fx, $type, $owner, $cost, $pfdate, $name) =
@row_ary;
| < if ($fx ne $Config{currency}) {
| < $fxthen = GetFXDatum($dbh, $pfdate, $fx);
| < $fxnow = GetFXDatum($dbh, $date, $fx);
| < print "Running SQL for $pfdate and $fx: $fxthen -> $fxnow\n" if
$Config{debug};
| < }
| < my $pnl = $nb * ($prices->{$name}*$fxnow - $cost*$fxthen);
| < printf "%-7.7s%7d%5s%8s%8s%8.2f%12s%8.2f%11.2f\n",
| < $stock, $nb, $fx, $type, $owner, $cost, $pfdate, $prices->{$name},
$pnl;
| < $sum = $sum + $pnl;
| ---
| > # print the results
| > print "$tl\n\t\t\t\tPortfolio listing\n$fl\n";
| > printf "%-7.7s%7.7s%5.5s%8.8s%8.8s%10.10s%12.12s%10.10s%11s\n$fl\n",
| > "Symbol", "Shares", "FX", " Type", " Owner", " Cost", " Date",
| > " Price", " Net";
| > my $sum = 0;
| > while (my @row_ary = $sth->fetchrow_array) {
| > my ($fxthen,$fxnow) = (1.0,1.0);
| > my ($stock, $nb, $fx, $type, $owner, $cost, $pfdate, $name) = @row_ary;
| > if ($fx ne $Config{currency}) {
| > $fxthen = GetFXDatum($dbh, $pfdate, $fx);
| > $fxnow = GetFXDatum($dbh, $date, $fx);
| > print "Running SQL for $pfdate and $fx: $fxthen -> $fxnow\n" if
$Config{debug};
| 694c686,689
| < printf "$fl\nTotal profit or loss\t\t\t\t\t%18.2f\n$tl\n", $sum;
| ---
| > my $pnl = $nb * ($prices->{$name}*$fxnow - $cost*$fxthen);
| > printf "%-7.7s%7d%5s%8s%8s%10.2f%12s%10.2f%11.2f\n",
| > $stock, $nb, $fx, $type, $owner, $cost, $pfdate, $prices->{$name},
$pnl;
| > $sum = $sum + $pnl;
| 695a691
| > printf "$fl\nTotal profit or loss\t\t\t\t\t%22.2f\n$tl\n", $sum;
--
Dirk Eddelbuettel | [email protected] | http://dirk.eddelbuettel.com
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]