diff options
author | Kjetil Ørbekk <orbekk@pvv.ntnu.no> | 2010-09-04 02:49:00 -0400 |
---|---|---|
committer | Kjetil Ørbekk <orbekk@pvv.ntnu.no> | 2010-09-04 02:49:00 -0400 |
commit | 5ae25cd60e5b8a939166b1f9a55b445b1cb2a7ea (patch) | |
tree | c9ec10c8ed03320fdf14f5b40b906936bdf33122 | |
parent | 69dd5ce3fdc53d35da12837ac67451c159546b97 (diff) |
Update ImportQuotes script.
Add votes explicitly now that they are no longer an attribute in the
quotes.
-rw-r--r-- | html/quotes.jsp | 2 | ||||
-rw-r--r-- | src/lq/Doubles.java | 2 | ||||
-rw-r--r-- | src/lq/ImportQuotes.java | 8 |
3 files changed, 9 insertions, 3 deletions
diff --git a/html/quotes.jsp b/html/quotes.jsp index 9571430..49e203a 100644 --- a/html/quotes.jsp +++ b/html/quotes.jsp @@ -26,7 +26,7 @@ hr { Quotes fra #linux.no på freenode Klikk <a href="add.jsp">her</a> for å legge til en quote - Sortér etter <a href="quotes.jsp?order=date">quote-dato</a> | <a href="quotes.jsp?order=score">score</a> | <a href="quotes.jsp?order=timestamp">timestamp</a> + Sortér etter <a href="quotes.jsp?order=date">quote-dato</a> | <a href="quotes.jsp?order=score">score</a> | <a href="quotes.jsp?order=timestamp">timestamp</a> </pre> <hr> 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."); |