def search_issue(all_issue, user_id): key = str(user_id) + "_issue_searchkeyword" result = all_issue if RedisService.has_key(key): search_word = RedisService.get_value(key) result = result.filter(Title__icontains=search_word) return result
def all_issues(project_id, user_id): result = IssueService.project_all_issues(project_id) filter_key = str(user_id) + "_issue_filter" if RedisService.has_key(filter_key): filter_values = RedisService.get_svalue(filter_key) result = IssueService.filter_all_issues(result, filter_values) result = IssueService.search_issue(result, user_id) return result
def create_issue_filter(project_id, filter_id, filter_name, user_id): if str(filter_id) == "0": temp_filter = IssueFilter() else: temp_filter = IssueFilter.objects.get(int(filter_id)) temp_filter.Project = int(project_id) temp_filter.FilterName = filter_name temp_filter.Creator = int(user_id) filter_key = str(user_id) + "_issue_filter" if RedisService.has_key(filter_key): filter_values = RedisService.get_svalue(filter_key) temp_filter.FilterString = IssueService.get_filter_string(filter_values) temp_filter.FilterUIConfig = IssueService.filter_value_dict(filter_key) temp_filter.FilterCacheString = filter_values temp_filter.Scope = 1 temp_filter.save() return temp_filter.id
def cache_issue_search_word(key, value): if RedisService.has_key(key): RedisService.delete_value(key) RedisService.set_value(key, value, 1800) else: RedisService.set_value(key, value, 1800)