summaryrefslogtreecommitdiff
path: root/src/lq/Quote.java
diff options
context:
space:
mode:
authorKjetil Ørbekk <orbekk@pvv.ntnu.no>2010-09-03 01:11:03 -0400
committerKjetil Ørbekk <orbekk@pvv.ntnu.no>2010-09-03 01:11:03 -0400
commitb2dd8bf148b70c3076625840f908b5c7d32e9ee1 (patch)
tree79c06b1a051db27eaec3be859abb3bd6bce3210d /src/lq/Quote.java
parentc0927a7ec954652d411ae4293fb0b1f4edad3a4c (diff)
Make ImportQuote work on AppEngine.
Saving the entire database in one request caused a timeout. Instead, save one quote (plus its votes) per request.
Diffstat (limited to 'src/lq/Quote.java')
-rw-r--r--src/lq/Quote.java8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/lq/Quote.java b/src/lq/Quote.java
index b0595b7..8edefaa 100644
--- a/src/lq/Quote.java
+++ b/src/lq/Quote.java
@@ -51,6 +51,14 @@ public class Quote {
this.timestamp = new Date();
}
+ public Double getScore() {
+ Double score = 0.0;
+ for (Vote vote : getVotes()) {
+ score = score + vote.getRating() / getVotes().size();
+ }
+ return score;
+ }
+
public Key getKey() { return key; }
public Long getId() { return id; }
public Date getTimestamp() { return timestamp; }