Rensselaer Center for Open Source Software

Updated returnjob - it now works.

2 files changed, 15 lines added, 3 lines removed

Changes

--- analysis/training-set/returnjob.py 7b5229086e9b9878746014fe82c37ef45b8413aa
+++ analysis/training-set/returnjob.py cbb65c9648b269267e7ee315f1a01d5a9cc085a3
@@ -8,6 +8,12 @@
+    try:
+      articleid = int(articleid)
+      score = int(score)
+    except:
+      return "FAILURE"
+
@@ -15,10 +21,16 @@
+    if score == -1:
+      field = "trainneg"
+    elif score == 0:
+      field = "trainneutral"
+    elif score == 1:
+      field = "trainpos"
+
-    #sql = "UPDATE trainset SET score=%s WHERE id=%s"
-    sql = "UPDATE articles SET score=%s WHERE id=%s"
-    args = score,articleid
+    sql = "UPDATE articles SET " + field + "=" + field + "+1 WHERE id=%s"
+    args = articleid
Michael
DaBuzz • 65 weeks ago