Beispiel #1
0
def git_commits(acc_id, ticket_name):
    ticket = JiraDatabase()
    ticket_info = ticket.get_ticket_by_name(ticket_name)
    github_object = GitDatabase()
    user_object = UserDatabase()
    git_id = user_object.get_user_id(acc_id)[0].get('github_id')
    git_commits = github_object.get_commits_from_user(ticket_name, git_id)
    return flask.jsonify({"ticket_info": ticket_info, "git_commits": git_commits})
Beispiel #2
0
def git_commits(acc_id, ticket_name):
    ticket = JiraDatabase()
    ticket_info = ticket.get_ticket_by_name(ticket_name)
    github_object = GitDatabase()
    user_object = UserDatabase()
    git_id = user_object.get_user_id(acc_id)[0].get('github_id')
    github_service = GitServices(ticket_name, git_id)
    git_commits = github_object.get_commits_from_user(ticket_name, git_id)
    graph_data = github_service.get_time_commit()
    return flask.jsonify({"ticket_info": ticket_info, "git_commits": git_commits, "graph_data": graph_data})
    def get_issues(self, jc):
        print("Calling job ==========>")
        projects = jc.projects()
        issues_final = []
        user_final = []
        for v in projects:
            issues_in_proj = jc.search_issues(f'project={v.key}')
            for issues in issues_in_proj:
                cache_ticket = json.loads(redis.get('ticket_id'))
                if issues.id not in cache_ticket:
                    print("mofo")
                    cache_ticket.append(issues.id)
                    redis.set('ticket_id', json.dumps(cache_ticket))
                    issue_temp = {
                        'issue_id': issues.id,
                        'ticket_name': issues.key,
                        'created_on': issues.fields.created,
                        'status': dict(issues.fields.status.raw),
                        'assignee': dict(issues.fields.assignee.raw),
                        'start_time': '',
                        'end_time': '',
                        'pause_time': '',
                        'total_time_spent': '',
                        'commits': []
                    }
                    issues_final.append(issue_temp)
                    cache_user = json.loads(redis.get('user_id'))
                    print('=======>', cache_user)
                    if issues.fields.assignee.accountId not in cache_user:
                        print("mofo2")
                        cache_user.append(issues.fields.assignee.accountId)
                        redis.set('user_id', json.dumps(cache_user))
                        user_final.append(dict(issues.fields.assignee.raw))

        if (len(user_final) > 0):
            to_mongo = UserDatabase()
            print('USER To mongo ==========>', user_final)
            response = to_mongo.write_users(user_final)
            print('USER Mongo Response ==========>', response)
        if (len(issues_final) > 0):
            to_mongo = JiraDatabase()
            print('TICKET To mongo ==========>', issues_final)
            response = to_mongo.write_all_tickets(issues_final)
            print('TICKET Mongo Response ==========>', response)
Beispiel #4
0
def users():
    user = UserDatabase()
    response = user.get_all_users()
    return flask.jsonify({"result": response})
Beispiel #5
0
 def save(self):
     user_database = UserDatabase()
     response = user_database.write_user(self.data)
     return response
Beispiel #6
0
        "https://secure.gravatar.com/avatar/e41b551f404194c47f1af8e809934243?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FRS-3.png&size=16&s=16",
        "24x24":
        "https://secure.gravatar.com/avatar/e41b551f404194c47f1af8e809934243?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FRS-3.png&size=24&s=24",
        "32x32":
        "https://secure.gravatar.com/avatar/e41b551f404194c47f1af8e809934243?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FRS-3.png&size=32&s=32",
        "48x48":
        "https://secure.gravatar.com/avatar/e41b551f404194c47f1af8e809934243?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FRS-3.png&size=48&s=48"
    },
    "displayName": "Rohit Shrothrium",
    "github_id": "randr97",
}
nausheen_data = {
    "name": "nausheen.sultana0212",
    "accountId": "5d53d144400d9d0d9f53c55b",
    "avatarUrls": {
        "16x16":
        "https://secure.gravatar.com/avatar/1f2ba8b8e5429ce1d4e1c881537ffcc4?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FNS-0.png&size=16&s=16",
        "24x24":
        "https://secure.gravatar.com/avatar/1f2ba8b8e5429ce1d4e1c881537ffcc4?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FNS-0.png&size=24&s=24",
        "32x32":
        "https://secure.gravatar.com/avatar/1f2ba8b8e5429ce1d4e1c881537ffcc4?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FNS-0.png&size=32&s=32",
        "48x48":
        "https://secure.gravatar.com/avatar/1f2ba8b8e5429ce1d4e1c881537ffcc4?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FNS-0.png&size=48&s=48"
    },
    "displayName": "Nausheen Sultana",
    "github_id": "NausheenSultana",
}
UserDatabase().delete_all_users()
UserJob(**dhruva_data).save()
UserJob(**rohit_data).save()
UserJob(**nausheen_data).save()