M1-Arborator-NaijaSUD/arborator/lib/database.py
def statustree(self, sid, snr, visibletreeid, userid, username, textid, admin):
		"""
		called from statusChange.cgi
		
		since the user can change the status we know that she is annotator or validator
		usually, the user changes her own tree's status
		if she doesn't have a tree, we copy the visible tree and give it the new status
		
		"""
		answerdic={}
		status="no tree"
		db,cursor=self.open()
		
		for _,_,_,_,status,comment,_ in self.getall(cursor, "trees",["sentenceid","userid"], [sid,userid]):
			if not status:status=0
			status=int(status)+1
			if str(status) not in self.projectconfig["tree status"]: status=0
		if status=="no tree": # copy visible tree
			status=1
			nodedic = self.gettree(None,None,visibletreeid)["tree"]
			#print "jjj",nodedic
			t=self.tokenName
			tds = self.gettodostatus(userid,textid)
			if tds<1:tds=0 # tds=1 means this is a validator
			wcounter, sent, treeid = self.enterTree(cursor, nodedic, sid, userid, intokenname=t)
			db.commit()
			links=self.links2AllTrees(sid,snr,username,admin,validator=tds)
			answerdic["links"]=links[0]
		cursor.execute("UPDATE trees SET status=? WHERE sentenceid=? AND userid=?",(status,sid,userid,))
		db.commit()
		db.close()
		answerdic["status"]=self.projectconfig["tree status"].get(str(status),"ooo")
		return answerdic

		called from statusChange.cgi
		
		since the user can change the status we know that she is annotator or validator
		usually, the user changes her own tree's status
		if she doesn't have a tree, we copy the visible tree and give it the new status
		
		
called from statusChange.cgi
since the user can change the status we know that she is annotator or validator
usually, the user changes her own tree's status
if she doesn't have a tree, we copy the visible tree and give it the new status
called from statusChange . cgi since the user can change the status we know that she is annotator or validator usually the user changes her own tree ' s status if she doesn ' t have a tree we copy the visible tree and give it the new status
def statustree(self, sid, snr, visibletreeid, userid, username, textid, admin):
		answerdic={}
		status="no tree"
		db,cursor=self.open()
		for _,_,_,_,status,comment,_ in self.getall(cursor, "trees",["sentenceid","userid"], [sid,userid]):
			if not status:status=0
			status=int(status)+1
			if str(status) not in self.projectconfig["tree status"]: status=0
		if status=="no tree": 
			status=1
			nodedic = self.gettree(None,None,visibletreeid)["tree"]
			t=self.tokenName
			tds = self.gettodostatus(userid,textid)
			if tds<1:tds=0 
			wcounter, sent, treeid = self.enterTree(cursor, nodedic, sid, userid, intokenname=t)
			db.commit()
			links=self.links2AllTrees(sid,snr,username,admin,validator=tds)
			answerdic["links"]=links[0]
		cursor.execute("UPDATE trees SET status=? WHERE sentenceid=? AND userid=?",(status,sid,userid,))
		db.commit()
		db.close()
		answerdic["status"]=self.projectconfig["tree status"].get(str(status),"ooo")
		return answerdic
def statustree ( self , sid , snr , visibletreeid , userid , username , textid , admin ) : answerdic = { } status = "no tree" db , cursor = self . open ( ) for _ , _ , _ , _ , status , comment , _ in self . getall ( cursor , "trees" , [ "sentenceid" , "userid" ] , [ sid , userid ] ) : if not status : status = 0 status = int ( status ) + 1 if str ( status ) not in self . projectconfig [ "tree status" ] : status = 0 if status == "no tree" : status = 1 nodedic = self . gettree ( None , None , visibletreeid ) [ "tree" ] t = self . tokenName tds = self . gettodostatus ( userid , textid ) if tds < 1 : tds = 0 wcounter , sent , treeid = self . enterTree ( cursor , nodedic , sid , userid , intokenname = t ) db . commit ( ) links = self . links2AllTrees ( sid , snr , username , admin , validator = tds ) answerdic [ "links" ] = links [ 0 ] cursor . execute ( "UPDATE trees SET status=? WHERE sentenceid=? AND userid=?" , ( status , sid , userid , ) ) db . commit ( ) db . close ( ) answerdic [ "status" ] = self . projectconfig [ "tree status" ] . get ( str ( status ) , "ooo" ) return answerdic
called from statusChange.cgi
since the user can change the status we know that she is annotator or validator
usually, the user changes her own tree's status
if she doesn't have a tree, we copy the visible tree and give it the new status
called from statusChange . cgi since the user can change the status we know that she is annotator or validator usually the user changes her own tree ' s status if she doesn ' t have a tree we copy the visible tree and give it the new status
"""
		called from statusChange.cgi
		
		since the user can change the status we know that she is annotator or validator
		usually, the user changes her own tree's status
		if she doesn't have a tree, we copy the visible tree and give it the new status
		
		""" # copy visible tree #print "jjj",nodedic # tds=1 means this is a validator
self
sid
snr
visibletreeid
userid
username
textid
admin