From ca7bbb46ce4c5a903f91c056fc117925310d7dd8 Mon Sep 17 00:00:00 2001 From: Lennart Weller Date: Sun, 17 Mar 2013 00:25:43 +0100 Subject: changed the string to a price object --- src/db.vala | 14 ++++---------- src/web.vala | 4 ++-- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/src/db.vala b/src/db.vala index dc1c834..f938cc8 100644 --- a/src/db.vala +++ b/src/db.vala @@ -19,8 +19,8 @@ public struct StockEntry { public string id; public string name; public int amount; - public string memberprice; - public string guestprice; + public Price memberprice; + public Price guestprice; } public struct PriceEntry { @@ -350,16 +350,10 @@ public class Database { statements["stock_status"].column_text(0), statements["stock_status"].column_text(1), statements["stock_status"].column_int(2), - null, - null + statements["stock_status"].column_int(3), + statements["stock_status"].column_int(4) }; - Price mprice = statements["stock_status"].column_int(3); - Price gprice = statements["stock_status"].column_int(4); - - entry.memberprice = @"$mprice"; - entry.guestprice = @"$gprice"; - result.add(entry); } diff --git a/src/web.vala b/src/web.vala index 7140c22..c61c8b9 100644 --- a/src/web.vala +++ b/src/web.vala @@ -440,8 +440,8 @@ public class WebServer { string table = ""; foreach(var e in db.get_stock()) { - table += "%s%s%d%s€%s€".printf( - e.id, e.id, e.id, e.name, e.amount, e.memberprice, e.guestprice + table += "%s%s%df%€%f€".printf( + e.id, e.id, e.id, e.name, e.amount, e.memberprice / 100, e.guestprice / 100 ); } -- cgit v1.2.3