コード例 #1
0
	def add(cls, follower, following, weight=1):
		""" Returns 0 if it """
		cursor = dbi.execute(
			"INSERT IGNORE INTO analytics_follow (follower,following,weight) VALUES(%s,%s,%s)"
			,(follower,following,weight)
		)
		return (cursor.lastrowid!=0)
コード例 #2
0
	def remove_comment(cls, usr, content):
		dbi.execute(
			"UPDATE analytics_content SET comments=comments-1 WHERE content=%s"
			,(content,)
		)
コード例 #3
0
	def add_invite(cls, follower, following):
		cls.assert_exists(follower, following)
		dbi.execute(
			"UPDATE analytics_follow SET invites = invites+1 WHERE follower=%s and following=%s"
			,(follower, following)
		)
コード例 #4
0
	def remove_comment(cls, follower, following):
		dbi.execute(
			"UPDATE analytics_follow SET comments = comments-1 WHERE follower=%s and following=%s"
			,(follower, following)
		)
コード例 #5
0
	def remove(cls, follower, following):
		cursor = dbi.execute(
			"DELETE FROM analytics_follow WHERE follower=%s and following=%s"
			,(follower,following)
		)
		return (cursor.rowcount!=0)
コード例 #6
0
 def remove_comment(cls, usr, content, tabloid):
     dbi.execute(
         "UPDATE analytics_tabloidentry SET comments=comments-1 WHERE tabloid=%s and content=%s"(tabloid, content)
     )
コード例 #7
0
 def remove_view(cls, usr, content, tabloid):
     dbi.execute("UPDATE analytics_tabloidentry SET views=views-1 WHERE tabloid=%s and content=%s"(tabloid, content))
コード例 #8
0
	def add(cls, usr, content):
		dbi.execute(
			"INSERT INTO analytics_usr_seen (usr,content) VALUES(%s,%s) "
			,(usr, content)
		)
コード例 #9
0
	def remove_invite(cls, usr, tabloid):
		dbi.execute(
			"UPDATE analytics_tabloid SET invites=invites-1 WHERE tabloid=%s"
			,(tabloid,)
		)
コード例 #10
0
	def add_invite(cls, usr, tabloid):
		cls.assert_exists(tabloid)
		dbi.execute(
			"UPDATE analytics_tabloid SET invites=invites+1 WHERE tabloid=%s"
			,(tabloid,)
		)
コード例 #11
0
	def get_owner(cls, tabloid):
		row = dbi.execute("SELECT usr FROM analytics_tabloid WHERE tabloid=%s",(tabloid,)).fetchone()
		if row is not None:
			return row["usr"]
		else:
			return None
コード例 #12
0
	def remove_view(cls, usr, tabloid):
		dbi.execute(
			"UPDATE analytics_tabloid SET views=views+1 WHERE tabloid=%s"
			,(tabloid,)
		)
コード例 #13
0
	def add_view(cls, usr, tabloid):
		cls.assert_exists(tabloid)
		dbi.execute(
			"UPDATE analytics_tabloid SET views=views+1 WHERE tabloid=%s"
			,(tabloid,)
		)
コード例 #14
0
	def add(cls, usr, tabloid):
		dbi.execute(				
			"INSERT INTO analytics_tabloid (tabloid,usr) VALUES(%s,%s)"
			,(tabloid,usr)
		)
コード例 #15
0
	def add_time_spent(cls, usr, content):
		cls.assert_exists(content)
		dbi.execute(
			"UPDATE analytics_content SET time_spent=time_spent+%s WHERE content=%s"
			,(content,time_spent)
		)
コード例 #16
0
	def remove_time_spent(cls, usr, content, time_spent):
		dbi.execute(
			"UPDATE analytics_content_usr SET time_spent=time_spent-%s WHERE usr=%s, content=%s"
			,(time_spent, usr,content,)
		)
コード例 #17
0
	def remove(cls, usr, content):
		dbi.execute(
			"DELETE FROM analytics_usr_seen WHERE usr=%s AND content=%s"
			,(usr, content)
		)
コード例 #18
0
	def add_content(cls, usr, tabloid):
		cls.assert_exists(tabloid)
		dbi.execute(
			"UPDATE analytics_tabloid SET contents=contents+1 WHERE tabloid=%s"
			,(tabloid,)
		)
コード例 #19
0
 def remove(cls, usr, content, tabloid):
     cursor = dbi.execute("DELETE FROM analytics_tabloidentry WHERE tabloid=%s AND content=%s ", (tabloid, content))
     return cursor.rowcount != 0
コード例 #20
0
	def remove_content(cls, usr, tabloid):
		dbi.execute(
			"UPDATE analytics_tabloid SET contents=contents-1 WHERE tabloid=%s"
			,(tabloid,)
		)
コード例 #21
0
 def add_comment(cls, usr, content, tabloid):
     cls.assert_exists(content, tabloid)
     dbi.execute(
         "UPDATE analytics_tabloidentry SET comments=comments+1 WHERE tabloid=%s and content=%s"(tabloid, content)
     )
コード例 #22
0
	def add_markread(cls, usr, content):
		dbi.execute(
			"INSERT INTO analytics_usr_content (user, content, markread) VALUES(%s,%s,%s) "
			" ON DUPLICATE KEY UPDATE markread=%s "
			, (usr, content, 1, 1)
		)
コード例 #23
0
 def add(cls, usr, content, tabloid):
     cursor = dbi.execute(
         "INSERT IGNORE INTO analytics_tabloidentry (tabloid,usr,content,category) VALUES(%s,%s,%s,%s)",
         (tabloid, usr, content, category),
     )
     return cursor.lastrowid != 0
コード例 #24
0
	def remove_markread(cls, usr, content):
		dbi.execute(
			" UPDATE analytics_usr_content SET markread=%s WHERE usr=%s AND content=%s "
			, (0, usr, content)
		)
コード例 #25
0
	def add_comment(cls, follower, following):
		cls.assert_exists(follower, following)
		dbi.execute(
			"UPDATE analytics_follow SET comments = comments+1 WHERE follower=%s and following=%s"
			,(follower, following)
		)
コード例 #26
0
	def add_share(cls, usr, content):
		dbi.execute(
			"INSERT INTO analytics_usr_content (user, content, shares) VALUES(%s,%s,%s) "
			" ON DUPLICATE KEY UPDATE shares=%s "
			, (usr, content, 1, 1)
		)
コード例 #27
0
	def remove_share(cls, usr, content):
		dbi.execute(
			" UPDATE analytics_usr_content SET shares=%s WHERE usr=%s AND content=%s "
			, (0, usr, content)
		)
コード例 #28
0
	def add_time_spent(cls, usr, content, time_spent):
		dbi.execute(
			"INSERT INTO analytics_content_usr (usr,content,time_spent) VALUES(%s,%s,%s) "
			" SET time_spent=time_spent+%s "
			,(usr,content,time_spent,time_spent)
		)
コード例 #29
0
	def remove_invite(cls, follower, following):
		dbi.execute(
			"UPDATE analytics_follow SET invites = invites-1 WHERE follower=%s and following=%s"
			,(follower, following)
		)
コード例 #30
0
	def add_comment(cls, usr, content):
		cls.assert_exists(content)
		dbi.execute(
			"UPDATE analytics_content SET comments=comments+1 WHERE content=%s"
			,(content,)
		)