示例#1
0
 def cache_issue_filter(key, values):
     field_name = values.split(":")[0]
     old_filter = RedisService.get_svalue(key)
     for item in old_filter:
         filter_member = item
         if filter_member.startswith(field_name):
             RedisService.delete_smember(key, filter_member)
     RedisService.set_svalue(key, values, 7 * 24 * 3600)
示例#2
0
 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
示例#3
0
 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
示例#4
0
 def filter_value_dict(filter_key):
     result = dict()
     filter_values = RedisService.get_svalue(filter_key)
     for filter_item in filter_values:
         filter_item_value = filter_item
         print(filter_item_value)
         filter_field = filter_item_value.split(":")[0]
         filter_value = filter_item_value.split(":")[1]
         if filter_value == "":
             filter_value = "0,0"
         if filter_field.endswith("_s"):
             dict_key = filter_field.replace("_s", "")
             result[dict_key] = eval("[" + filter_value + "]")
         else:
             if filter_field == "CreationTime":
                 start_date = filter_value[:11].strip()
                 end_date = filter_value[12:].strip()
                 result[filter_field] = eval("['" + start_date + "','" + end_date + "']")
             else:
                 result[filter_field] = filter_value
     return result