Skip to content

Commit

Permalink
Merge pull request #103 from egabancho/master-bibrank-no-method-found
Browse files Browse the repository at this point in the history
BibRank: no rank method fix
  • Loading branch information
egabancho authored and switowski committed Sep 1, 2015
2 parents 164b589 + 006a499 commit 62997bb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions modules/bibrank/lib/bibrank_citation_searcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,10 @@ def cache_filler():

def timestamp_verifier():
citation_lastupdate = get_lastupdated('citation')
if citation_lastupdate:
try:
return citation_lastupdate.strftime("%Y-%m-%d %H:%M:%S")
else:
return "0000-00-00 00:00:00"
except AttributeError:
return citation_lastupdate

DataCacher.__init__(self, cache_filler, timestamp_verifier)

Expand Down
10 changes: 5 additions & 5 deletions modules/bibrank/lib/bibrank_tag_based_indexer.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,8 @@ def get_lastupdated(rank_method_code):
if res:
return res[0][0]
else:
raise Exception("Is this the first run? Please do a complete update.")
# raise Exception("Is this the first run? Please do a complete update.")
return "1970-01-01 00:00:00"

def intoDB(dic, date, rank_method_code):
"""Insert the rank method data into the database"""
Expand All @@ -209,6 +210,8 @@ def intoDB(dic, date, rank_method_code):
def fromDB(rank_method_code):
"""Get the data for a rank method"""
id = run_sql("SELECT id from rnkMETHOD where name=%s", (rank_method_code, ))
if not id:
return {}
res = run_sql("SELECT relevance_data FROM rnkMETHODDATA WHERE id_rnkMETHOD=%s", (id[0][0], ))
if res:
return deserialize_via_marshal(res[0][0])
Expand Down Expand Up @@ -394,10 +397,7 @@ def add_recIDs_by_date(rank_method_code, dates=""):
the ranking method RANK_METHOD_CODE.
"""
if not dates:
try:
dates = (get_lastupdated(rank_method_code), '')
except Exception:
dates = ("0000-00-00 00:00:00", '')
dates = (get_lastupdated(rank_method_code), '')
if dates[0] is None:
dates = ("0000-00-00 00:00:00", '')
query = """SELECT b.id FROM bibrec AS b WHERE b.modification_date >= %s"""
Expand Down

0 comments on commit 62997bb

Please sign in to comment.