From 5ae25cd60e5b8a939166b1f9a55b445b1cb2a7ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kjetil=20=C3=98rbekk?= Date: Sat, 4 Sep 2010 02:49:00 -0400 Subject: Update ImportQuotes script. Add votes explicitly now that they are no longer an attribute in the quotes. --- src/lq/Doubles.java | 2 +- src/lq/ImportQuotes.java | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/lq/Doubles.java b/src/lq/Doubles.java index 551e65a..a24a9ec 100644 --- a/src/lq/Doubles.java +++ b/src/lq/Doubles.java @@ -1,7 +1,7 @@ package lq; public class Doubles { - public static final int signum(Double d) { + public static final int signum(double d) { if (d < 0.0) { return -1; } diff --git a/src/lq/ImportQuotes.java b/src/lq/ImportQuotes.java index 634521c..fc365a0 100644 --- a/src/lq/ImportQuotes.java +++ b/src/lq/ImportQuotes.java @@ -59,7 +59,13 @@ public class ImportQuotes extends HttpServlet { } else { int importId = Integer.parseInt(importIdString); - pm.makePersistent(quotes.get(importId)); + Quote q = quotes.get(importId); + pm.makePersistent(q); + for (Vote v : votes) { + if (v.getQuoteId() == q.getId()) { + pm.makePersistent(v); + } + } resp.getWriter().println("There are " + quotes.size() + " quotes in the old db."); resp.getWriter().println("Quote " + importId + " imported."); -- cgit v1.2.3