mirror of
https://github.com/jlengrand/twitterboard.git
synced 2026-03-10 08:51:22 +00:00
Implements member creation. Existing member detection working as well. Still has to find a clever way to flush data to db. Also creates a sublime project in repo.
This commit is contained in:
BIN
twiderboard.db
BIN
twiderboard.db
Binary file not shown.
@@ -57,6 +57,10 @@ class Counter():
|
|||||||
t_auth = tweet.author
|
t_auth = tweet.author
|
||||||
print "###"
|
print "###"
|
||||||
print t_auth, t_hash
|
print t_auth, t_hash
|
||||||
|
debug = self.session.query(Member).all()
|
||||||
|
print "''''''''''''''''''''''"
|
||||||
|
for d in debug:
|
||||||
|
print d.author, d.hashtag
|
||||||
m_query = self.session.query(Member).filter(Member.author == t_auth).filter(Member.hashtag == t_hash)
|
m_query = self.session.query(Member).filter(Member.author == t_auth).filter(Member.hashtag == t_hash)
|
||||||
|
|
||||||
# Checking if we already have such a member
|
# Checking if we already have such a member
|
||||||
@@ -82,7 +86,24 @@ class Counter():
|
|||||||
print "Cannot create Member, Tweet is not valid"
|
print "Cannot create Member, Tweet is not valid"
|
||||||
raise Exception
|
raise Exception
|
||||||
|
|
||||||
|
self.session.add(member)
|
||||||
|
|
||||||
|
cpt = 1
|
||||||
|
|
||||||
|
# trying to flush if needed
|
||||||
|
if cpt >= 1: # FIXME: Raise limit later on
|
||||||
|
self.session.commit() # force saving changes
|
||||||
|
print "Commiting"
|
||||||
|
cpt = 0
|
||||||
|
|
||||||
|
def member_count(self):
|
||||||
|
"""
|
||||||
|
Returns the number of Members in table
|
||||||
|
"""
|
||||||
|
query = self.session.query(Member).order_by(Member.id).all()
|
||||||
|
print "Members: %d" % (len(query))
|
||||||
|
|
||||||
engine_url = 'sqlite:///twiderboard.db'
|
engine_url = 'sqlite:///twiderboard.db'
|
||||||
c = Counter(engine_url)
|
c = Counter(engine_url)
|
||||||
c.count()
|
c.count()
|
||||||
|
c.member_count()
|
||||||
8
twitterboard.sublime-project
Normal file
8
twitterboard.sublime-project
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"folders":
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"path": "/home/airballman/Documents/twiderboard/twitterboard"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
185
twitterboard.sublime-workspace
Normal file
185
twitterboard.sublime-workspace
Normal file
@@ -0,0 +1,185 @@
|
|||||||
|
{
|
||||||
|
"auto_complete":
|
||||||
|
{
|
||||||
|
"selected_items":
|
||||||
|
[
|
||||||
|
[
|
||||||
|
"has",
|
||||||
|
"has_author"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"a",
|
||||||
|
"author"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"t_",
|
||||||
|
"t_hash"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"sum",
|
||||||
|
"sum_elements"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"pow",
|
||||||
|
"pow_to_go"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"process",
|
||||||
|
"process_running"
|
||||||
|
]
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"buffers":
|
||||||
|
[
|
||||||
|
],
|
||||||
|
"build_system": "",
|
||||||
|
"command_palette":
|
||||||
|
{
|
||||||
|
"height": 348.0,
|
||||||
|
"selected_items":
|
||||||
|
[
|
||||||
|
[
|
||||||
|
"acka",
|
||||||
|
"Package Control: Install Package"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"pack",
|
||||||
|
"Package Control: Install Package"
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"width": 449.0
|
||||||
|
},
|
||||||
|
"console":
|
||||||
|
{
|
||||||
|
"height": 139.0
|
||||||
|
},
|
||||||
|
"distraction_free":
|
||||||
|
{
|
||||||
|
"menu_visible": true,
|
||||||
|
"show_minimap": false,
|
||||||
|
"show_open_files": false,
|
||||||
|
"show_tabs": false,
|
||||||
|
"side_bar_visible": false,
|
||||||
|
"status_bar_visible": false
|
||||||
|
},
|
||||||
|
"file_history":
|
||||||
|
[
|
||||||
|
"/home/airballman/.gitconfig",
|
||||||
|
"/home/airballman/Documents/twiderboard/twitterboard/.git/COMMIT_EDITMSG",
|
||||||
|
"/home/airballman/Desktop/Taf/workspace/project_euler/README.markdown",
|
||||||
|
"/home/airballman/.config/sublime-text-2/Packages/User/Preferences.sublime-settings"
|
||||||
|
],
|
||||||
|
"find":
|
||||||
|
{
|
||||||
|
"height": 35.0
|
||||||
|
},
|
||||||
|
"find_in_files":
|
||||||
|
{
|
||||||
|
"height": 0.0,
|
||||||
|
"where_history":
|
||||||
|
[
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"find_state":
|
||||||
|
{
|
||||||
|
"case_sensitive": false,
|
||||||
|
"find_history":
|
||||||
|
[
|
||||||
|
"on_e"
|
||||||
|
],
|
||||||
|
"highlight": true,
|
||||||
|
"in_selection": false,
|
||||||
|
"preserve_case": false,
|
||||||
|
"regex": false,
|
||||||
|
"replace_history":
|
||||||
|
[
|
||||||
|
],
|
||||||
|
"reverse": false,
|
||||||
|
"show_context": true,
|
||||||
|
"use_buffer2": true,
|
||||||
|
"whole_word": false,
|
||||||
|
"wrap": true
|
||||||
|
},
|
||||||
|
"groups":
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"sheets":
|
||||||
|
[
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"sheets":
|
||||||
|
[
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"incremental_find":
|
||||||
|
{
|
||||||
|
"height": 0.0
|
||||||
|
},
|
||||||
|
"input":
|
||||||
|
{
|
||||||
|
"height": 0.0
|
||||||
|
},
|
||||||
|
"layout":
|
||||||
|
{
|
||||||
|
"cells":
|
||||||
|
[
|
||||||
|
[
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
1,
|
||||||
|
1
|
||||||
|
],
|
||||||
|
[
|
||||||
|
1,
|
||||||
|
0,
|
||||||
|
2,
|
||||||
|
1
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"cols":
|
||||||
|
[
|
||||||
|
0.0,
|
||||||
|
0.5302734375,
|
||||||
|
1.0
|
||||||
|
],
|
||||||
|
"rows":
|
||||||
|
[
|
||||||
|
0.0,
|
||||||
|
1.0
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"menu_visible": true,
|
||||||
|
"output.exec":
|
||||||
|
{
|
||||||
|
"height": 100.0
|
||||||
|
},
|
||||||
|
"replace":
|
||||||
|
{
|
||||||
|
"height": 0.0
|
||||||
|
},
|
||||||
|
"save_all_on_build": true,
|
||||||
|
"select_file":
|
||||||
|
{
|
||||||
|
"height": 0.0,
|
||||||
|
"selected_items":
|
||||||
|
[
|
||||||
|
],
|
||||||
|
"width": 0.0
|
||||||
|
},
|
||||||
|
"select_project":
|
||||||
|
{
|
||||||
|
"height": 0.0,
|
||||||
|
"selected_items":
|
||||||
|
[
|
||||||
|
],
|
||||||
|
"width": 0.0
|
||||||
|
},
|
||||||
|
"show_minimap": true,
|
||||||
|
"show_open_files": false,
|
||||||
|
"show_tabs": true,
|
||||||
|
"side_bar_visible": true,
|
||||||
|
"side_bar_width": 150.0,
|
||||||
|
"status_bar_visible": true
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user