Ejemplo n.º 1
0
 def list_repo_user_stats(self, repo_id, datetypeStr, fromDateTime):
     if datetypeStr not in self.datetypeDict:
         return []
     datetype = self.datetypeDict[datetypeStr]
     repo_stats = query(StatsRepo, repo_id, 'per_statsrepo_l_cons',
                        [repo_id, 1, datetype, fromDateTime])
     return repo_stats
Ejemplo n.º 2
0
 def list_user_repo_stats(self, user_id, datetypeStr, fromDateTime):
     if datetypeStr not in self.datetypeDict:
         return []
     datetype = self.datetypeDict[datetypeStr]
     user_stats = query(StatsUser, user_id, 'per_statsuser_l_cons',
                        [user_id, 1, datetype, fromDateTime])
     return user_stats
Ejemplo n.º 3
0
 def watch_repo(self, user, userprofile, watch_repo):
     if watch_repo.auth_type == 2:
         if not self.is_repo_member(watch_repo, user):
             return False
     if userprofile.watchrepo >= 100:
         return False
     watchHistorys = query(WatchHistory, userprofile.id,
                           'watchhistory_s_repo',
                           [userprofile.id, watch_repo.id])
     feedAction = FeedAction()
     timestamp = int(time.time())
     if len(watchHistorys) > 0:
         # redis action
         feedAction.add_watch_repo(userprofile.id, timestamp, watch_repo.id)
         return True
     watchHistory = WatchHistory()
     watchHistory.user_id = userprofile.id
     watchHistory.watch_repo_id = watch_repo.id
     watchHistory.save()
     userprofile.watchrepo = userprofile.watchrepo + 1
     userprofile.save()
     watch_repo.watch = watch_repo.watch + 1
     watch_repo.save()
     # redis action
     feedAction.add_watch_repo(userprofile.id, timestamp, watch_repo.id)
     return True
Ejemplo n.º 4
0
 def list_allrepo_stats(self, datetypeStr, fromDateTime, offset, row_count):
     if datetypeStr not in self.datetypeDict:
         return []
     datetype = self.datetypeDict[datetypeStr]
     repo_stats = query(StatsRepo, None, 'allstatsrepo_l_cons',
                        [1, datetype, fromDateTime, offset, row_count])
     return repo_stats
Ejemplo n.º 5
0
    def list_permissionItem_by_setId(self, set_id, repo_id):
        if set_id == 0:
            return []
        permissionItems = query(PermissionItem, set_id, 'permissionitem_l_setId', [set_id])
        if len(permissionItems) == 0:
            return []
        from gitshell.repo.models import Repo, RepoManager
        userprofile_dict = dict((x.id, x)for x in RepoManager.list_repo_team_memberUser(repo_id))

        teamGroup_dict = {}
        for x in permissionItems:
            if x.group_id in teamGroup_dict:
                continue
            teamGroup = self.get_teamGroup_by_id(x.group_id)
            if not teamGroup:
                continue
            teamGroup_dict[teamGroup.id] = teamGroup

        filtered_permissionItems = []
        for permissionItem in permissionItems:
            if permissionItem.user_id not in userprofile_dict and permissionItem.group_id not in teamGroup_dict:
                permissionItem.visibly = 1
                permissionItem.save()
                continue
            if permissionItem.user_id in userprofile_dict:
                permissionItem.userprofile = userprofile_dict[permissionItem.user_id]
            if permissionItem.group_id in teamGroup_dict:
                permissionItem.group = teamGroup_dict[permissionItem.group_id]
            if permissionItem.permission in PERMISSION.VIEW:
                permissionItem.permission_view = PERMISSION.VIEW[permissionItem.permission]
            filtered_permissionItems.append(permissionItem)

        return filtered_permissionItems
Ejemplo n.º 6
0
 def list_pullRequest_by_pullUserId(self, pullUser_id):
     offset = 0
     row_count = 100
     pullRequests = query(PullRequest, None, 'pullrequest_l_pullUserId', [pullUser_id, offset, row_count])
     for pullRequest in pullRequests:
         pullRequest.fillwith()
     return pullRequests
Ejemplo n.º 7
0
 def watch_user(self, userprofile, watch_userprofile):
     if userprofile.id == watch_userprofile.id:
         return False
     if userprofile.watch >= 100:
         return False
     watchHistorys = query(WatchHistory, userprofile.id, 'watchhistory_s_user', [userprofile.id, watch_userprofile.id])
     feedAction = FeedAction()
     timestamp = int(time.time())
     if len(watchHistorys) > 0:
         # redis action
         feedAction.add_watch_user(userprofile.id, timestamp, watch_userprofile.id)
         feedAction.add_bewatch_user(watch_userprofile.id, timestamp, userprofile.id)
         return True
     watchHistory = WatchHistory()
     watchHistory.user_id = userprofile.id
     watchHistory.watch_user_id = watch_userprofile.id
     watchHistory.save()
     userprofile.watch = userprofile.watch + 1
     userprofile.save()
     watch_userprofile.be_watched = watch_userprofile.be_watched + 1
     watch_userprofile.save()
     # redis action
     feedAction.add_watch_user(userprofile.id, timestamp, watch_userprofile.id)
     feedAction.add_bewatch_user(watch_userprofile.id, timestamp, userprofile.id)
     return True
Ejemplo n.º 8
0
 def list_pullRequest_by_teamUserId_mergeUserId(self, team_user_id, mergeUser_id):
     offset = 0
     row_count = 100
     pullRequests = query(PullRequest, None, 'pullrequest_l_descUserId_mergeUserId', [team_user_id, mergeUser_id, offset, row_count])
     for pullRequest in pullRequests:
         pullRequest.fillwith()
     return pullRequests
Ejemplo n.º 9
0
 def unwatch_user(self, userprofile, watch_userprofile):
     if userprofile.id == watch_userprofile.id:
         return False
     watchHistorys = query(WatchHistory, userprofile.id,
                           'watchhistory_s_user',
                           [userprofile.id, watch_userprofile.id])
     watchHistory = None
     if len(watchHistorys) > 0:
         watchHistory = watchHistorys[0]
     if watchHistory is not None:
         watchHistory.visibly = 1
         watchHistory.save()
         userprofile.watch = userprofile.watch - 1
         if userprofile.watch < 0:
             userprofile.watch = 0
         userprofile.save()
         watch_userprofile.be_watched = watch_userprofile.be_watched - 1
         if watch_userprofile.be_watched < 0:
             watch_userprofile.be_watched = 0
         watch_userprofile.save()
     # redis action
     feedAction = FeedAction()
     feedAction.remove_watch_user(userprofile.id, watch_userprofile.id)
     feedAction.remove_bewatch_user(watch_userprofile.id, userprofile.id)
     return True
Ejemplo n.º 10
0
 def list_notifmessage_by_toUserId_teamUserId(self, to_user_id,
                                              team_user_id, offset,
                                              row_count):
     notifMessages = query(NotifMessage, to_user_id,
                           'notifmessage_l_toUserId_userId',
                           [to_user_id, team_user_id, offset, row_count])
     return self._fillwith_notifMessages(notifMessages)
Ejemplo n.º 11
0
 def watch_user(self, userprofile, watch_userprofile):
     if userprofile.id == watch_userprofile.id:
         return False
     if userprofile.watch >= 100:
         return False
     watchHistorys = query(WatchHistory, userprofile.id,
                           'watchhistory_s_user',
                           [userprofile.id, watch_userprofile.id])
     feedAction = FeedAction()
     timestamp = int(time.time())
     if len(watchHistorys) > 0:
         # redis action
         feedAction.add_watch_user(userprofile.id, timestamp,
                                   watch_userprofile.id)
         feedAction.add_bewatch_user(watch_userprofile.id, timestamp,
                                     userprofile.id)
         return True
     watchHistory = WatchHistory()
     watchHistory.user_id = userprofile.id
     watchHistory.watch_user_id = watch_userprofile.id
     watchHistory.save()
     userprofile.watch = userprofile.watch + 1
     userprofile.save()
     watch_userprofile.be_watched = watch_userprofile.be_watched + 1
     watch_userprofile.save()
     # redis action
     feedAction.add_watch_user(userprofile.id, timestamp,
                               watch_userprofile.id)
     feedAction.add_bewatch_user(watch_userprofile.id, timestamp,
                                 userprofile.id)
     return True
Ejemplo n.º 12
0
 def list_pullRequest_by_descRepoId(self, descRepo_id):
     offset = 0
     row_count = 100
     pullRequests = query(PullRequest, descRepo_id, 'pullrequest_l_descRepoId', [descRepo_id, offset, row_count])
     for pullRequest in pullRequests:
         pullRequest.fillwith()
     return pullRequests
Ejemplo n.º 13
0
 def list_pullRequest_by_mergeUserId(self, mergeUser_id):
     offset = 0
     row_count = 100
     pullRequests = query(PullRequest, None, 'pullrequest_l_mergeUserId',
                          [mergeUser_id, offset, row_count])
     for pullRequest in pullRequests:
         pullRequest.fillwith()
     return pullRequests
Ejemplo n.º 14
0
 def list_commit_by_repoId_pushrevrefId(self, repo_id, pushrevref_id,
                                        offset, row_count):
     commits = query(CommitHistory, repo_id,
                     'commithistory_l_repoId_pushrevrefId',
                     [repo_id, pushrevref_id, offset, row_count])
     for commit in commits:
         commit.fillwith()
     return commits
Ejemplo n.º 15
0
 def list_assigned_issues(self, assigned, orderby, offset, row_count):
     rawsql_id = 'issue_l_assigned_modify'
     if orderby == 'create_time':
         rawsql_id = 'issue_l_assigned_create'
     assigned_issues = query(Issue, None, rawsql_id, [assigned, offset, row_count]) 
     for issue in assigned_issues:
         issue.fillwith()
     return assigned_issues
Ejemplo n.º 16
0
 def list_issues(self, repo_id, orderby, offset, row_count):
     rawsql_id = 'issue_l_cons_modify'
     if orderby == 'create_time':
         rawsql_id = 'issue_l_cons_create'
     issues = query(Issue, repo_id, rawsql_id, [repo_id, offset, row_count]) 
     for issue in issues:
         issue.fillwith()
     return issues
Ejemplo n.º 17
0
 def list_scene_by_userId(self, user_id, offset, row_count):
     scenes = query(Scene, user_id, 'scene_l_userId', [user_id, offset, row_count])
     for scene in scenes:
         if scene.name == '':
             scenes.remove(scene)
             scenes.insert(0, scene)
             break
     return scenes
Ejemplo n.º 18
0
 def list_watch_user(self, repo_id):
     watchHistory = query(WatchHistory, None, 'watchhistory_l_repoId', [repo_id])
     user_ids = [o.user_id for o in watchHistory]
     user_map = GsuserManager.map_users(user_ids)
     watch_user = []
     for user_id in user_ids:
         if user_id in user_map:
             watch_user.append(user_map[user_id])
     return watch_user
Ejemplo n.º 19
0
 def list_groupMember_by_teamGroupId(self, group_id):
     groupMembers = query(GroupMember, group_id, 'groupmember_l_groupId', [group_id])
     user_ids = [x.member_user_id for x in groupMembers]
     userprofiles = GsuserManager.list_userprofile_by_ids(user_ids)
     userprofile_dict = dict((x.id, x)for x in userprofiles)
     for x in groupMembers:
         if x.member_user_id in userprofile_dict:
             x.member_userprofile = userprofile_dict[x.member_user_id]
     return groupMembers
Ejemplo n.º 20
0
 def list_teamMember_by_teamUserId(self, team_user_id):
     userprofile = GsuserManager.get_userprofile_by_id(team_user_id)
     if userprofile.is_team_account == 0:
         return []
     teamMembers = query(TeamMember, team_user_id, 'teammember_l_teamUserId', [team_user_id])
     for x in teamMembers:
         x.user = GsuserManager.get_userprofile_by_id(x.user_id)
         x.team_user = userprofile
     return teamMembers
Ejemplo n.º 21
0
 def list_teamMember_by_userId(self, user_id):
     userprofile = GsuserManager.get_userprofile_by_id(user_id)
     if userprofile.has_joined_team == 0:
         return []
     teamMembers = query(TeamMember, None, 'teammember_l_userId', [user_id])
     for x in teamMembers:
         x.user = GsuserManager.get_userprofile_by_id(x.user_id)
         x.team_user = GsuserManager.get_userprofile_by_id(x.team_user_id)
     return teamMembers
Ejemplo n.º 22
0
 def list_scene_by_userId(self, user_id, offset, row_count):
     scenes = query(Scene, user_id, 'scene_l_userId',
                    [user_id, offset, row_count])
     for scene in scenes:
         if scene.name == '':
             scenes.remove(scene)
             scenes.insert(0, scene)
             break
     return scenes
Ejemplo n.º 23
0
 def list_pullRequest_by_descRepoId(self, descRepo_id):
     offset = 0
     row_count = 100
     pullRequests = query(PullRequest, descRepo_id,
                          'pullrequest_l_descRepoId',
                          [descRepo_id, offset, row_count])
     for pullRequest in pullRequests:
         pullRequest.fillwith()
     return pullRequests
Ejemplo n.º 24
0
 def list_pullRequest_by_teamUserId_pullUserId(self, team_user_id,
                                               pullUser_id):
     offset = 0
     row_count = 100
     pullRequests = query(PullRequest, None,
                          'pullrequest_l_descUserId_pullUserId',
                          [team_user_id, pullUser_id, offset, row_count])
     for pullRequest in pullRequests:
         pullRequest.fillwith()
     return pullRequests
Ejemplo n.º 25
0
 def list_watch_user(self, repo_id):
     watchHistory = query(WatchHistory, None, 'watchhistory_l_repoId',
                          [repo_id])
     user_ids = [o.user_id for o in watchHistory]
     user_map = GsuserManager.map_users(user_ids)
     watch_user = []
     for user_id in user_ids:
         if user_id in user_map:
             watch_user.append(user_map[user_id])
     return watch_user
Ejemplo n.º 26
0
 def list_star_repo(self, user_id, offset, row_count):
     stars = query(Star, user_id, 'star_l_userId', [user_id, offset, row_count])
     repos = []
     for x in stars:
         repo = RepoManager.get_repo_by_id(x.star_repo_id)
         if repo is None or repo.visibly == 1:
             x.visibly = 1
             x.save()
             continue
         repos.append(repo)
     return repos
Ejemplo n.º 27
0
 def list_fork_repo(self, repo_id):
     forkRepos = query(Repo, None, 'repo_l_forkRepoId', [repo_id])
     repo_ids = [o.id for o in forkRepos]
     unorder_repos = get_many(Repo, repo_ids)
     repo_map = {}
     for repo in unorder_repos:
         repo_map[repo.id] = repo
     order_repos = []
     for repo_id in repo_ids:
         if repo_id in repo_map:
             order_repos.append(repo_map[repo_id])
     return order_repos
Ejemplo n.º 28
0
 def list_star_repo(self, user_id, offset, row_count):
     stars = query(Star, user_id, 'star_l_userId',
                   [user_id, offset, row_count])
     repos = []
     for x in stars:
         repo = RepoManager.get_repo_by_id(x.star_repo_id)
         if repo is None or repo.visibly == 1:
             x.visibly = 1
             x.save()
             continue
         repos.append(repo)
     return repos
Ejemplo n.º 29
0
 def get_scene_by_id(self, user_id, scene_id):
     if scene_id == 0:
         scene = self.get_scene_by_name(user_id, '')
         if scene is not None:
             return scene
         scene = Scene.create(user_id, '')
         scene.save()
         return scene
     scenes = query(Scene, user_id, 'scene_l_userId_id', [user_id, scene_id])
     if len(scenes) > 0:
         return scenes[0]
     return None
Ejemplo n.º 30
0
 def list_fork_repo(self, repo_id):
     forkRepos = query(Repo, None, 'repo_l_forkRepoId', [repo_id]) 
     repo_ids = [o.id for o in forkRepos]
     unorder_repos = get_many(Repo, repo_ids)
     repo_map = {}
     for repo in unorder_repos:
         repo_map[repo.id] = repo
     order_repos = [] 
     for repo_id in repo_ids:
         if repo_id in repo_map:
             order_repos.append(repo_map[repo_id])
     return order_repos
Ejemplo n.º 31
0
 def list_joined_repo_by_userId(self, user_id, offset, row_count):
     userprofile = GsuserManager.get_userprofile_by_id(user_id)
     if userprofile is None or userprofile.has_joined_repo == 0:
         return []
     repoemembers = query(RepoMember, None, 'repomember_l_userId', [user_id, offset, row_count])
     joined_repos = []
     for repoemember in repoemembers:
         repo = self.get_repo_by_id(repoemember.repo_id)
         if repo is None:
             repoemember.delete()
             continue
         joined_repos.append(repo)
     return joined_repos
Ejemplo n.º 32
0
 def get_scene_by_id(self, user_id, scene_id):
     if scene_id == 0:
         scene = self.get_scene_by_name(user_id, '')
         if scene is not None:
             return scene
         scene = Scene.create(user_id, '')
         scene.save()
         return scene
     scenes = query(Scene, user_id, 'scene_l_userId_id',
                    [user_id, scene_id])
     if len(scenes) > 0:
         return scenes[0]
     return None
Ejemplo n.º 33
0
 def list_joined_repo_by_userId(self, user_id, offset, row_count):
     userprofile = GsuserManager.get_userprofile_by_id(user_id)
     if userprofile is None or userprofile.has_joined_repo == 0:
         return []
     repoemembers = query(RepoMember, None, 'repomember_l_userId',
                          [user_id, offset, row_count])
     joined_repos = []
     for repoemember in repoemembers:
         repo = self.get_repo_by_id(repoemember.repo_id)
         if repo is None:
             repoemember.delete()
             continue
         joined_repos.append(repo)
     return joined_repos
Ejemplo n.º 34
0
 def list_notifmessage_by_userId_betweenTime_notifTypes(self, user_id, from_time, to_time, notif_types, offset, row_count):
     notifMessages = []
     if notif_types == 'all':
         notifMessages = query(NotifMessage, user_id, 'notifmessage_l_toUserId_modifyTime', [user_id, from_time, to_time, offset, row_count])
     else:
         filtered_notif_types = []
         split_notif_types = notif_types.split(',')
         for split_notif_type in split_notif_types:
             if re.match('^\d+$', split_notif_type):
                 filtered_notif_types.append(int(split_notif_type))
         if len(filtered_notif_types) == 0:
             return []
         notifMessages = list(NotifMessage.objects.filter(visibly=0).filter(to_user_id=user_id).filter(modify_time__gt=from_time).filter(modify_time__lte=to_time).filter(notif_type__in=filtered_notif_types).order_by('-modify_time')[offset : offset+row_count])
     return self._fillwith_notifMessages(notifMessages)
Ejemplo n.º 35
0
 def list_star_user(self, repo_id, offset, row_count):
     stars = query(Star, None, 'star_l_repoId', [repo_id, offset, row_count])
     userprofiles = []
     for x in stars:
         user = GsuserManager.get_user_by_id(x.user_id)
         userprofile = GsuserManager.get_userprofile_by_id(x.user_id)
         if userprofile is None or userprofile.visibly == 1:
             x.visibly = 1
             x.save()
             continue
         userprofile.date_joined = time.mktime(user.date_joined.timetuple())
         userprofile.last_login = time.mktime(user.last_login.timetuple())
         userprofiles.append(userprofile)
     return userprofiles
Ejemplo n.º 36
0
 def list_star_user(self, repo_id, offset, row_count):
     stars = query(Star, None, 'star_l_repoId',
                   [repo_id, offset, row_count])
     userprofiles = []
     for x in stars:
         user = GsuserManager.get_user_by_id(x.user_id)
         userprofile = GsuserManager.get_userprofile_by_id(x.user_id)
         if userprofile is None or userprofile.visibly == 1:
             x.visibly = 1
             x.save()
             continue
         userprofile.date_joined = time.mktime(user.date_joined.timetuple())
         userprofile.last_login = time.mktime(user.last_login.timetuple())
         userprofiles.append(userprofile)
     return userprofiles
Ejemplo n.º 37
0
 def unwatch_repo(self, user, userprofile, watch_repo):
     watchHistorys = query(WatchHistory, userprofile.id, 'watchhistory_s_repo', [userprofile.id, watch_repo.id])
     watchHistory = None
     if len(watchHistorys) > 0:
         watchHistory = watchHistorys[0]
     if watchHistory is not None:
         watchHistory.visibly = 1
         watchHistory.save()
         userprofile.watchrepo = userprofile.watchrepo - 1
         if userprofile.watchrepo < 0:
             userprofile.watchrepo = 0
         userprofile.save()
         watch_repo.watch = watch_repo.watch - 1
         if watch_repo.watch < 0:
             watch_repo.watch = 0
         watch_repo.save()
     # redis action
     feedAction = FeedAction()
     feedAction.remove_watch_repo(userprofile.id, watch_repo.id)
     return True
Ejemplo n.º 38
0
 def unwatch_repo(self, user, userprofile, watch_repo):
     watchHistorys = query(WatchHistory, userprofile.id,
                           'watchhistory_s_repo',
                           [userprofile.id, watch_repo.id])
     watchHistory = None
     if len(watchHistorys) > 0:
         watchHistory = watchHistorys[0]
     if watchHistory is not None:
         watchHistory.visibly = 1
         watchHistory.save()
         userprofile.watchrepo = userprofile.watchrepo - 1
         if userprofile.watchrepo < 0:
             userprofile.watchrepo = 0
         userprofile.save()
         watch_repo.watch = watch_repo.watch - 1
         if watch_repo.watch < 0:
             watch_repo.watch = 0
         watch_repo.save()
     # redis action
     feedAction = FeedAction()
     feedAction.remove_watch_repo(userprofile.id, watch_repo.id)
     return True
Ejemplo n.º 39
0
 def list_notifmessage_by_userId_betweenTime_notifTypes(
         self, user_id, from_time, to_time, notif_types, offset, row_count):
     notifMessages = []
     if notif_types == 'all':
         notifMessages = query(
             NotifMessage, user_id, 'notifmessage_l_toUserId_modifyTime',
             [user_id, from_time, to_time, offset, row_count])
     else:
         filtered_notif_types = []
         split_notif_types = notif_types.split(',')
         for split_notif_type in split_notif_types:
             if re.match('^\d+$', split_notif_type):
                 filtered_notif_types.append(int(split_notif_type))
         if len(filtered_notif_types) == 0:
             return []
         notifMessages = list(
             NotifMessage.objects.filter(visibly=0).filter(
                 to_user_id=user_id).filter(
                     modify_time__gt=from_time).filter(
                         modify_time__lte=to_time).filter(
                             notif_type__in=filtered_notif_types).order_by(
                                 '-modify_time')[offset:offset + row_count])
     return self._fillwith_notifMessages(notifMessages)
Ejemplo n.º 40
0
 def unwatch_user(self, userprofile, watch_userprofile):
     if userprofile.id == watch_userprofile.id:
         return False
     watchHistorys = query(WatchHistory, userprofile.id, 'watchhistory_s_user', [userprofile.id, watch_userprofile.id])
     watchHistory = None
     if len(watchHistorys) > 0:
         watchHistory = watchHistorys[0]
     if watchHistory is not None:
         watchHistory.visibly = 1
         watchHistory.save()
         userprofile.watch = userprofile.watch - 1
         if userprofile.watch < 0:
             userprofile.watch = 0
         userprofile.save()
         watch_userprofile.be_watched = watch_userprofile.be_watched - 1
         if watch_userprofile.be_watched < 0:
             watch_userprofile.be_watched = 0
         watch_userprofile.save()
     # redis action
     feedAction = FeedAction()
     feedAction.remove_watch_user(userprofile.id, watch_userprofile.id)
     feedAction.remove_bewatch_user(watch_userprofile.id, userprofile.id)
     return True
Ejemplo n.º 41
0
 def watch_repo(self, user, userprofile, watch_repo):
     if watch_repo.auth_type == 2:
         if not self.is_repo_member(watch_repo, user):
             return False
     if userprofile.watchrepo >= 100:
         return False
     watchHistorys = query(WatchHistory, userprofile.id, 'watchhistory_s_repo', [userprofile.id, watch_repo.id])
     feedAction = FeedAction()
     timestamp = int(time.time())
     if len(watchHistorys) > 0:
         # redis action
         feedAction.add_watch_repo(userprofile.id, timestamp, watch_repo.id)
         return True
     watchHistory = WatchHistory()
     watchHistory.user_id = userprofile.id
     watchHistory.watch_repo_id = watch_repo.id
     watchHistory.save()
     userprofile.watchrepo = userprofile.watchrepo + 1
     userprofile.save()
     watch_repo.watch = watch_repo.watch + 1
     watch_repo.save()
     # redis action
     feedAction.add_watch_repo(userprofile.id, timestamp, watch_repo.id)
     return True
Ejemplo n.º 42
0
 def list_notifsetting_by_expectNotifTime(self, expect_notif_time, offset, row_count):
     notifSettings = query(NotifSetting, None, 'notifsetting_l_expectNotifTime', [expect_notif_time, offset, row_count])
     return notifSettings
Ejemplo n.º 43
0
 def get_repo_member(self, repo_id, user_id):
     repoMembers = query(RepoMember, repo_id, 'repomember_s_ruid', [repo_id, user_id])
     if len(repoMembers) > 0:
         return repoMembers[0]
     return None
Ejemplo n.º 44
0
 def __get_stats_user(self, user_id, hash_id):
     user_stats = query(StatsUser, user_id, 'statsuser_s_hash_id', [user_id, hash_id])
     if len(user_stats) > 0:
         return user_stats[0]
     return None
Ejemplo n.º 45
0
 def __get_stats_repo(self, repo_id, hash_id):
     repo_stats = query(StatsRepo, repo_id, 'statsrepo_s_hash_id', [repo_id, hash_id])
     if len(repo_stats) > 0:
         return repo_stats[0]
     return None
Ejemplo n.º 46
0
 def list_user_repo_stats(self, user_id, datetypeStr, fromDateTime):
     if datetypeStr not in self.datetypeDict:
         return []
     datetype = self.datetypeDict[datetypeStr]
     user_stats = query(StatsUser, user_id, 'per_statsuser_l_cons', [user_id, 1, datetype, fromDateTime])
     return user_stats
Ejemplo n.º 47
0
 def list_repo_user_stats(self, repo_id, datetypeStr, fromDateTime):
     if datetypeStr not in self.datetypeDict:
         return []
     datetype = self.datetypeDict[datetypeStr]
     repo_stats = query(StatsRepo, repo_id, 'per_statsrepo_l_cons', [repo_id, 1, datetype, fromDateTime])
     return repo_stats
Ejemplo n.º 48
0
 def get_repo_member(self, repo_id, user_id):
     repoMembers = query(RepoMember, repo_id, 'repomember_s_ruid',
                         [repo_id, user_id])
     if len(repoMembers) > 0:
         return repoMembers[0]
     return None
Ejemplo n.º 49
0
 def list_repomember(self, repo_id):
     repoemembers = query(RepoMember, repo_id, 'repomember_l_repoId',
                          [repo_id])
     return repoemembers
Ejemplo n.º 50
0
 def list_allrepo_stats(self, datetypeStr, fromDateTime, offset, row_count):
     if datetypeStr not in self.datetypeDict:
         return []
     datetype = self.datetypeDict[datetypeStr]
     repo_stats = query(StatsRepo, None, 'allstatsrepo_l_cons', [1, datetype, fromDateTime, offset, row_count])
     return repo_stats
Ejemplo n.º 51
0
 def list_webHookURL_by_repoId(self, repo_id):
     offset = 0; row_count = 100
     webHookURLs = query(WebHookURL, repo_id, 'webhookurl_l_repoId', [repo_id, offset, row_count])
     return webHookURLs
Ejemplo n.º 52
0
 def get_repo_by_userId_name(self, user_id, name):
     repoes = query(Repo, user_id, 'repo_s_userId_name', [user_id, name])
     if len(repoes) > 0:
         return repoes[0]
     return None
Ejemplo n.º 53
0
 def list_webHookURL_by_repoId(self, repo_id):
     offset = 0
     row_count = 100
     webHookURLs = query(WebHookURL, repo_id, 'webhookurl_l_repoId',
                         [repo_id, offset, row_count])
     return webHookURLs
Ejemplo n.º 54
0
 def list_notifmessage_by_toUserId_teamUserId(self, to_user_id, team_user_id, offset, row_count):
     notifMessages = query(NotifMessage, to_user_id, 'notifmessage_l_toUserId_userId', [to_user_id, team_user_id, offset, row_count])
     return self._fillwith_notifMessages(notifMessages)