diff --git a/apps/operations/views.py b/apps/operations/views.py index 033127a..2284a0c 100644 --- a/apps/operations/views.py +++ b/apps/operations/views.py @@ -948,11 +948,12 @@ def get_project_info(project_id): anno_sum = len(annos) issue_sum = len(Issue.objects.filter(project_id=project_id)) question_sum = len(Question.objects.filter(project_id=project_id)) + issue_question_sum = issue_sum + question_sum + # 参与用户数 usersum = len(annos.values('user_id').annotate(user_num=Count('user_id'))) - - + annoted_method_num = 0 # 获取文件信息和热门问题 anno_filenum = len(annos.values( 'file_id').annotate(file_num=Count('file_id'))) @@ -1021,9 +1022,11 @@ def get_annoted_method_num(file_ids): for i in range(len(file_ids)): file_id = file_ids[i] method_lines = get_files_method_lines(file_id) + if method_lines is None: + return 0 for j in range(len(method_lines)): current_line = method_lines[j] - if Annotation.objects.filter(linenum=current_line) is not None: + if len(Annotation.objects.filter(file_id__in=file_ids,linenum=current_line))>0: annoted_method_num = annoted_method_num + 1 return annoted_method_num # 调用api接口 @@ -1068,6 +1071,7 @@ def get_dir_info(project_id,path): question_sum += fileid_questionnum[i]['question_num'] issue_question_sum = issue_sum + question_sum + print(issue_question_sum) anno_num = len(Annotation.objects.filter(file_id=file_id)) question_num = len(Question.objects.filter(file_id=file_id)) diff --git a/templates/projects/filesub/dir_info.html b/templates/projects/filesub/dir_info.html index 119cc51..67b76ce 100644 --- a/templates/projects/filesub/dir_info.html +++ b/templates/projects/filesub/dir_info.html @@ -83,8 +83,9 @@ Comments

--> +
Annotated Files
-
Annotated Files
+
File Name Num.of Annotations