import psycopg2
import sys

from connect import connect_to_db

# add new temperature and date from arguments in command line
# add in values for cycle_begin, pos_lh <<<<<<
# filename counts as first arg
args = sys.argv
date = args[1] # second arg
temp = args[2] # third arg

# adding items to data
data = (date, temp)

# connect to database
conn = connect_to_db()
cur = conn.cursor()

# SQL for inserting values into db
SQL = "INSERT INTO BBT_CHART (DATE, TEMP) VALUES (%s, %s);"

# execute SQL command plus data
cur.execute(SQL, data)

print "Temperature data added"
conn.commit()
conn.close()

@@ -70,28 +70,38 @@
 new 
-temperature and date
+date, temp, cycle day, LH test
  fro
@@ -132,55 +132,8 @@
 ine%0A
-# add in values for cycle_begin, pos_lh %3C%3C%3C%3C%3C%3C%0A
 # fi
@@ -193,21 +193,8 @@
 s%5B1%5D
- # second arg
 %0Atem
@@ -208,20 +208,34 @@
 s%5B2%5D
- # third arg
+%0Acd = args%5B3%5D%0Alh = args%5B4%5D
 %0A%0A# 
@@ -273,16 +273,24 @@
 te, temp
+, cd, lh
 )%0A%0A# con
@@ -425,16 +425,36 @@
 TE, TEMP
+, CYCLE_DAY, LH_TEST
 ) VALUES
@@ -458,16 +458,24 @@
 UES (%25s,
+ %25s, %25s,
  %25s);%22%0A%0A
@@ -541,19 +541,11 @@
 nt %22
-Temperature
+New
  dat

add cycle day and lh test arguments into add_data