diff options
author | Bananeweizen <bananeweizen@gmx.de> | 2013-09-12 08:10:49 +0200 |
---|---|---|
committer | Bananeweizen <bananeweizen@gmx.de> | 2013-09-12 08:10:49 +0200 |
commit | cf4322dc3fdc337307e83ae65ef36dd89f8ef7c1 (patch) | |
tree | cd17415d817c197c4c12c9f07ac715b3af4ec91d /main/src/cgeo/geocaching/gcvote | |
parent | d47b38e071ab91e5f9b421f64dc18105f2596e68 (diff) | |
download | cgeo-cf4322dc3fdc337307e83ae65ef36dd89f8ef7c1.zip cgeo-cf4322dc3fdc337307e83ae65ef36dd89f8ef7c1.tar.gz cgeo-cf4322dc3fdc337307e83ae65ef36dd89f8ef7c1.tar.bz2 |
refactoring: cleanup of gcvote code
Diffstat (limited to 'main/src/cgeo/geocaching/gcvote')
-rw-r--r-- | main/src/cgeo/geocaching/gcvote/GCVote.java | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/main/src/cgeo/geocaching/gcvote/GCVote.java b/main/src/cgeo/geocaching/gcvote/GCVote.java index 15d0024..3f7d33d 100644 --- a/main/src/cgeo/geocaching/gcvote/GCVote.java +++ b/main/src/cgeo/geocaching/gcvote/GCVote.java @@ -195,14 +195,7 @@ public final class GCVote { * @return {@code true} if the rating was submitted successfully */ public static boolean setRating(final Geocache cache, final float vote) { - if (!Settings.isGCvoteLogin()) { - return false; - } - if (!cache.supportsGCVote()) { - return false; - } - String guid = cache.getGuid(); - if (StringUtils.isBlank(guid)) { + if (!isVotingPossible(cache)) { return false; } if (!isValidRating(vote)) { @@ -217,7 +210,7 @@ public final class GCVote { final Parameters params = new Parameters( "userName", login.left, "password", login.right, - "cacheId", guid, + "cacheId", cache.getGuid(), "voteUser", String.format("%.1f", vote).replace(',', '.'), "version", "cgeo"); @@ -271,4 +264,8 @@ public final class GCVote { return String.format(Locale.getDefault(), "%.1f", rating); } + public static boolean isVotingPossible(final Geocache cache) { + return Settings.isGCvoteLogin() && StringUtils.isNotBlank(cache.getGuid()) && cache.supportsGCVote(); + } + } |