Merge And Solve Conflict
This commit is contained in:
parent
ffd2f988c1
commit
e6b43dd8cd
|
@ -732,13 +732,26 @@ class Get_CodeReading_Content_View(View):
|
|||
return HttpResponse(json.dumps({"status": "success", "html_str": html_str}), content_type='application/json')
|
||||
# 根据path确定它是不是文件
|
||||
# (目前的判断方法是查看File_Anno_Issue_Summary表中是否有parentDir为传入的path,如果有说明是文件夹)
|
||||
isDir = (len(FileAnnoIssueSummary.objects.filter(project_id=project_id,parent_path=path))>0) if isDir:
|
||||
isDir = (len(FileSummary.objects.filter(project_id=project_id,parent_path=path))>0)
|
||||
if isDir:
|
||||
html_str = get_dir_info(project_id,path)
|
||||
return HttpResponse(json.dumps({"status": "success", "html_str": html_str,"is_dir":"1"}), content_type='application/json')
|
||||
else:
|
||||
html_str = get_code(request,project_id,path)
|
||||
return HttpResponse(json.dumps({"status": "success", "html_str": html_str,"is_dir":"0"}), content_type='application/json')
|
||||
# html_str = html_str.replace('style="background-color: white;"',"")
|
||||
def get_self_annos_by_fileid(user_id,file_id):
|
||||
self_anno_map = {}
|
||||
try:
|
||||
annos = Annotation.objects.filter(file_id=file_id,user_id=user_id)
|
||||
for anno in annos:
|
||||
self_anno_map[str(anno.linenum)] = anno.content
|
||||
return self_anno_map
|
||||
except:
|
||||
return self_anno_map
|
||||
|
||||
|
||||
def get_code(request,project_id,path):
|
||||
|
||||
project = Project.objects.filter(id=project_id).first()
|
||||
file = File.objects.filter(path=path, project_id=project_id).first()
|
||||
|
@ -758,6 +771,11 @@ class Get_CodeReading_Content_View(View):
|
|||
questions_count = {}
|
||||
for i in questions:
|
||||
questions_count[str(i['linenum'])] = i['nums']
|
||||
|
||||
if request.user.is_authenticated:
|
||||
self_annos = get_self_annos_by_fileid(request.user.pk,fileid)
|
||||
else:
|
||||
self_annos = {}
|
||||
|
||||
html_str = render_to_string('projects/filesub/code-reading.html', locals())
|
||||
return html_str
|
||||
|
@ -793,7 +811,7 @@ def get_project_info(project_id):
|
|||
usersum = len(annos.values('user_id').annotate(user_num=Count('user_id')))
|
||||
anno_filenum = len(annos.values(
|
||||
'file_id').annotate(file_num=Count('file_id')))
|
||||
anno_issue_summarys = FileAnnoIssueSummary.objects.filter(
|
||||
anno_issue_summarys = FileSummary.objects.filter(
|
||||
project_id=project_id, parent_path="")
|
||||
|
||||
#当前文件夹下所有的file_ids以及fileid与filename的映射
|
||||
|
|
|
@ -41,7 +41,6 @@ class NewProjectView(View):
|
|||
stragegy.project = project
|
||||
stragegy.choice = 1
|
||||
|
||||
return HttpResponse("Scanner Done!!")
|
||||
# logging.info(str(datetime.now()) + '导入工程完成')
|
||||
all_projects = Project.objects.all()
|
||||
return render(request, 'projects/list.html', locals())
|
||||
|
|
|
@ -3,20 +3,6 @@
|
|||
<p class="ques-title">
|
||||
该代码块共有{{annos|length}}个注释
|
||||
</p>
|
||||
<div class="parthalf_con clearfix">
|
||||
</div>
|
||||
</div>
|
||||
{% if comment.annotation.pk == self_anno.pk %}
|
||||
<div class="comment-item">
|
||||
<span class="color-grey-des mr10 colorblack inlineBlock fl ellipsis" title="{{ comment.content }}">{{ comment.content }}</span>
|
||||
<span class="color-grey-des inlineBlock fr">{{ comment.user.nick_name }}</span>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
{% else %}
|
||||
<h5>其他人的注释:</h5>
|
||||
{% for anno in annos%}
|
||||
{% if self_anno is None or anno.id != self_anno.id %}
|
||||
<div class="commentparthalf">
|
||||
|
@ -52,6 +38,5 @@
|
|||
</div>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
Loading…
Reference in New Issue