summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKjetil Ørbekk <orbekk@pvv.ntnu.no>2010-09-04 02:49:00 -0400
committerKjetil Ørbekk <orbekk@pvv.ntnu.no>2010-09-04 02:49:00 -0400
commit5ae25cd60e5b8a939166b1f9a55b445b1cb2a7ea (patch)
treec9ec10c8ed03320fdf14f5b40b906936bdf33122 /src
parent69dd5ce3fdc53d35da12837ac67451c159546b97 (diff)
Update ImportQuotes script.
Add votes explicitly now that they are no longer an attribute in the quotes.
Diffstat (limited to 'src')
-rw-r--r--src/lq/Doubles.java2
-rw-r--r--src/lq/ImportQuotes.java8
2 files changed, 8 insertions, 2 deletions
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.");