modify a little

This commit is contained in:
wrmswindmill 2018-08-23 20:05:59 +08:00
parent e9c64de9d8
commit 53f0bbb4e4
2 changed files with 6 additions and 3 deletions

View File

@ -120,7 +120,7 @@ WSGI_APPLICATION = 'Codepedia2.wsgi.application'
DATABASES = { DATABASES = {
'default': { 'default': {
'ENGINE': 'django.db.backends.mysql', 'ENGINE': 'django.db.backends.mysql',
'NAME': 'codepedia', 'NAME': 'codepedia_1',
'USER': 'root', 'USER': 'root',
'PASSWORD': 'codepedia123', 'PASSWORD': 'codepedia123',
'HOST': '127.0.0.1' 'HOST': '127.0.0.1'

View File

@ -86,11 +86,14 @@ class ShowAnnotationView(View):
def get_group_annotation(self,file_id,line_num,user_id): def get_group_annotation(self,file_id,line_num,user_id):
# 首先获取当前组的所有用户id # 首先获取当前组的所有用户id
# 根据到当前的id获取到group username list # 根据到当前的id获取到group username list
users = get_group_users(user_id,file_id) users = get_group_users(user_id,file_id)
# user_ids = [] # user_ids = []
# 然后调用 # 然后调用
commit_id = self.get_current_commitid_by_fileid(file_id) commit_id = self.get_current_commitid_by_fileid(file_id)
annotations = Annotation.objects.filter(file_id=file_id, linenum=line_num,user__in=users,is_latest=1,commit_id=commit_id) if users is None:
annotations = Annotation.objects.filter(file_id=file_id, linenum=line_num,user_id=user_id,is_latest=1,commit_id=commit_id)
else:
annotations = Annotation.objects.filter(file_id=file_id, linenum=line_num,user__in=users,is_latest=1,commit_id=commit_id)
return annotations return annotations