%inherit file="/base/index.html"/>
<%def name="title()">Previous Searches%def>
<%def name="heading()">
Your ${len(c.previousSearches)} Previous Searches (max ${c.maxNoPreviousSearches})
%def>
% if c.previousSearches:
% for i in range(len(c.previousSearches)):
<% searchDict = c.previousSearches[i]['result'] %>
${searchDict['timeSearched'].strftime('%b %d, %Y at %I:%M %p')}
<% content = 0 %>
% if searchDict['searchTerm1']:
% if searchDict['searchType1'] in ['as a phrase', 'as a reg exp', 'exactly']:
- search expression 1: ‘${searchDict['searchTerm1']}’ ${searchDict['searchType1']} in ${searchDict['searchLocation1']}
% else:
<% typeToBoolean = {'any of these': "' or '", 'all of these': "' and '"} %>
- search expression 1: ${searchDict['searchType1']} in ${searchDict['searchLocation1']}: ‘${typeToBoolean[searchDict['searchType1']].join(searchDict['searchTerm1'].split(' '))}’
% endif
<% content += 1 %>
% endif
% if searchDict['searchTerm2']:
<% booleanTranslator = {'not_':'and not', 'and_': 'and', 'or_': 'or'} %>
% if searchDict['searchType2'] in ['as a phrase', 'as a reg exp', 'exactly']:
- search expression 2: ${booleanTranslator[searchDict['andOrNot']]} ‘${searchDict['searchTerm2']}’ ${searchDict['searchType2']} in ${searchDict['searchLocation2']}
% else:
<% typeToBoolean = {'any of these': "' or '", 'all of these': "' and '"} %>
- search expression 2: ${booleanTranslator[searchDict['andOrNot']]} ${searchDict['searchType2']} in ${searchDict['searchLocation2']}: ‘${typeToBoolean[searchDict['searchType2']].join(searchDict['searchTerm2'].split(' '))}’
% endif
<% content += 1 %>
% endif
<% restrictors = [restrictor for restrictor in searchDict['restrictors'] if restrictor['options']] %>
% if restrictors:
% for restrictor in restrictors:
- restrictor: ${restrictor['location']} ID ${restrictor['containsNot']} ${restrictor['allAnyOf']} ${', '.join([restrictor or 'empty' for restrictor in restrictor['options']])}
% endfor
<% content += 1 %>
% endif
<% dateRestrictors = [restrictor for restrictor in searchDict['dateRestrictors'] if restrictor['date']] %>
% if dateRestrictors:
<% relationTranslator = {'not_': 'not', 'earlier_than': 'earlier than', 'later_than': 'later than', '': ''} %>
<% locationTranslator = {'dateElicited': 'date elicited', 'datetimeModified': 'date modified', 'datetimeEntered': 'date entered'} %>
% for restrictor in dateRestrictors:
- date restrictor: ${locationTranslator[restrictor['location']]} is ${relationTranslator[restrictor['relation']]} ${restrictor['date'].strftime('%b %d, %Y')}
% endfor
<% content += 1 %>
% endif
% if content is 0:
- Empty Search
% endif
% endfor
% endif