Skip to content

Commit

Permalink
remove history limit and fix status (#428)
Browse files Browse the repository at this point in the history
  • Loading branch information
fernandog committed Apr 19, 2016
1 parent 87e94f0 commit 2f3eb32
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
15 changes: 9 additions & 6 deletions gui/slick/views/snatchSelection.mako
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from sickbeard import subtitles, sbdatetime, network_timezones, helpers, show_name_helpers
import sickbeard.helpers
from sickbeard.common import SKIPPED, WANTED, UNAIRED, ARCHIVED, IGNORED, FAILED, DOWNLOADED
from sickbeard.common import SKIPPED, WANTED, UNAIRED, ARCHIVED, IGNORED, FAILED, DOWNLOADED, SNATCHED, SNATCHED_PROPER, SNATCHED_BEST
from sickbeard.common import Quality, qualityPresets, statusStrings, Overview
from sickbeard.helpers import anon_url
from sickrage.helper.common import pretty_file_size
Expand Down Expand Up @@ -213,18 +213,21 @@
<tbody class="toggle collapse" aria-live="polite" aria-relevant="all" id="historydata">
% if episode_history:
% for item in episode_history:
% if str(item['action'])[2:] == '04':
<% status, quality = Quality.splitCompositeStatus(item['action']) %>
% if status == DOWNLOADED:
<tr style="background-color:#C3E3C8;!important">
% elif str(item['action'])[2:] == '02':
% elif status in (SNATCHED, SNATCHED_PROPER, SNATCHED_BEST):
<tr style="background-color:#EBC1EA;!important">
% elif status == FAILED:
<tr style="background-color:#FF9999;!important">
% endif
<td align="center" style="width: auto;">
<% action_date = sbdatetime.sbfdatetime(datetime.datetime.strptime(str(item['date']), History.date_format), show_seconds=True) %>
${action_date}
</td>
<td align="center" style="width: auto;">
${statusStrings[Quality.splitCompositeStatus(item['action']).status]} ${renderQualityPill(Quality.splitCompositeStatus(item['action']).quality)}
${statusStrings[status]} ${renderQualityPill(quality)}
</td>
<td align="center" style="width: auto;">
<% provider = providers.getProviderClass(GenericProvider.make_id(item["provider"])) %>
Expand Down Expand Up @@ -320,9 +323,9 @@
below_minleech = True
%>
% if any([i for i in episode_history if prepareFailedName(str(hItem["name"])) in i['resource'] and (hItem['release_group'] == i['provider'] or hItem['provider'] == i['provider']) and str(i['action'])[2:] == '11' ]):
% if any([i for i in episode_history if prepareFailedName(str(hItem["name"])) in i['resource'] and (hItem['release_group'] == i['provider'] or hItem['provider'] == i['provider']) and str(i['action'])[2:] == '11']):
<tr style="text-decoration:line-through" id="S${season}E${episode} ${hItem["name"]}" class="skipped season-${season} seasonstyle" role="row">
% elif any([i for i in episode_history if str(i['action'])[2:] == '02' and hItem["name"] in i['resource'] and hItem['provider'] == i['provider']]):
% elif any([i for i in episode_history if str(i['action'])[2:] in ('02','09','12') and hItem["name"] in i['resource'] and hItem['provider'] == i['provider']]):
<tr style="background-color:#EBC1EA" id="S${season}E${episode} ${hItem["name"]}" class="skipped season-${season} seasonstyle" role="row">
% else:
<tr id="S${season}E${episode} ${hItem["name"]}" class="skipped season-${season} seasonstyle" role="row">
Expand Down
7 changes: 4 additions & 3 deletions sickbeard/webserve.py
Original file line number Diff line number Diff line change
Expand Up @@ -1638,9 +1638,10 @@ def titler(x):
episode_history = []
try:
main_db_con = db.DBConnection()
episode_status_result = main_db_con.action("SELECT date, action, provider, resource from history where showid = ? and \
season = ? and episode = ? and (action like '%4' or action like '%2' or action like '%11') \
order by date DESC LIMIT 10", [indexerid, season, episode])
episode_status_result = main_db_con.action("SELECT date, action, provider, resource FROM history WHERE showid = ? AND \
season = ? AND episode = ? AND (action LIKE '%02' OR action LIKE '%04'\
OR action LIKE '%09' OR action LIKE '%11' OR action LIKE '%12') \
ORDER BY date DESC", [indexerid, season, episode])
if episode_status_result:
for item in episode_status_result:
episode_history.append(dict(item))
Expand Down

0 comments on commit 2f3eb32

Please sign in to comment.