Created
September 4, 2014 14:42
-
-
Save esseti/fa6ba43cc37202bd1073 to your computer and use it in GitHub Desktop.
Performance generator PY
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from datetime import datetime | |
import random | |
#user id | |
userId=122 | |
sessionId = 143 #141 #142 #143 | |
# this is needed to keep track of the new ids we create and use them in the indicator_measure | |
ids = [] | |
id = int(datetime.utcnow().strftime("%s")) | |
for exercise in range(123,136,1): | |
for items in range(0,2,1): | |
id=id+1 | |
print ("Insert into SOCIAL_GYM.PERFORMANCE (ID,DEGREE,RECORD_DATE,ACTIVITYID,SESSIONID,USERID,STATUS,RECORD_TO,RECORD_FROM,SENSORID) values (%s,null,CURRENT_TIMESTAMP,%s,%s,%s,null,null,null,null);"%(id,exercise,sessionId,userId)) | |
ids.append(id); | |
id = int(datetime.utcnow().strftime("%s")) | |
for id_rel in ids: | |
id=id+1 | |
if (id_rel %2 == 0): | |
# if even add video | |
video = random.randrange(0,101) #one value from 0 to 100 (string?) | |
print ("Insert into SOCIAL_GYM.INDICATOR_MEASURE (ID,VALUE,PERFORMANCEID,INDICATORID,STATUS) values (%s,'%s',%s,5,null);" % (id,video,id_rel)) | |
else: | |
difficulty = random.randrange(1,6) #one value from 1 to 5 | |
completed = random.choice(['true','false']) #(string?) | |
print ("Insert into SOCIAL_GYM.INDICATOR_MEASURE (ID,VALUE,PERFORMANCEID,INDICATORID,STATUS) values (%s,'%s',%s,19,null);" % (id,difficulty,id_rel)) | |
id=id+1 | |
print ("Insert into SOCIAL_GYM.INDICATOR_MEASURE (ID,VALUE,PERFORMANCEID,INDICATORID,STATUS) values (%s,'%s',%s,6,null);" % (id,completed,id_rel)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment