This commit is contained in:
wrmswindmill 2018-08-23 10:49:02 +08:00
parent 93eba6358b
commit e9c64de9d8
2 changed files with 9 additions and 4 deletions

View File

@ -948,11 +948,12 @@ def get_project_info(project_id):
anno_sum = len(annos) anno_sum = len(annos)
issue_sum = len(Issue.objects.filter(project_id=project_id)) issue_sum = len(Issue.objects.filter(project_id=project_id))
question_sum = len(Question.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'))) usersum = len(annos.values('user_id').annotate(user_num=Count('user_id')))
annoted_method_num = 0
# 获取文件信息和热门问题 # 获取文件信息和热门问题
anno_filenum = len(annos.values( anno_filenum = len(annos.values(
'file_id').annotate(file_num=Count('file_id'))) '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)): for i in range(len(file_ids)):
file_id = file_ids[i] file_id = file_ids[i]
method_lines = get_files_method_lines(file_id) method_lines = get_files_method_lines(file_id)
if method_lines is None:
return 0
for j in range(len(method_lines)): for j in range(len(method_lines)):
current_line = method_lines[j] 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 annoted_method_num = annoted_method_num + 1
return annoted_method_num return annoted_method_num
# 调用api接口 # 调用api接口
@ -1068,6 +1071,7 @@ def get_dir_info(project_id,path):
question_sum += fileid_questionnum[i]['question_num'] question_sum += fileid_questionnum[i]['question_num']
issue_question_sum = issue_sum + question_sum issue_question_sum = issue_sum + question_sum
print(issue_question_sum)
anno_num = len(Annotation.objects.filter(file_id=file_id)) anno_num = len(Annotation.objects.filter(file_id=file_id))
question_num = len(Question.objects.filter(file_id=file_id)) question_num = len(Question.objects.filter(file_id=file_id))

View File

@ -83,8 +83,9 @@
<span class="fl mt7 info-nav">Comments</span> <span class="fl mt7 info-nav">Comments</span>
</p> </p>
</div> --> </div> -->
<div class="fl font-20 colorFFF">Annotated Files</div>
<div class="filePathInfo"> <div class="filePathInfo">
<div class="fl font-20 colorFFF">Annotated Files</div> <div></div>
<div class="clearfix filePathline fileinfo-item"> <div class="clearfix filePathline fileinfo-item">
<span>File Name</span> <span>File Name</span>
<span>Num.of Annotations</span> <span>Num.of Annotations</span>