Skip to content

Commit

Permalink
updated metric function tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ccarterlandis committed Jun 17, 2018
1 parent 31ed0f7 commit 1cb1f23
Show file tree
Hide file tree
Showing 118 changed files with 5,135 additions and 71 deletions.
26 changes: 0 additions & 26 deletions augur/ghtorrent.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,32 +372,6 @@ def forks(self, owner, repo=None, group_by="week"):
forksSQL = s.sql.text(self.__single_table_count_by_date('projects', 'forked_from', 'owner_id', group_by=group_by))
return pd.read_sql(forksSQL, self.db, params={"repoid": str(repoid)}).drop(0)

def issues_with_close(self, owner, repo=None):
"""
Subgroup: Issue Resolution
chaoss-metric: closed-issue-resolution-duration
How long on average each week it takes to close an issue
:param owner: The name of the project owner or the id of the project in the projects table of the project in the projects table. Use repoid() to get this.
:param repo: The name of the repo. Unneeded if repository id was passed as owner.
:return: DataFrame with issues/day
"""
repoid = self.repoid(owner, repo)
issuesWithCloseSQL = s.sql.text("""
SELECT issues.id as "id",
issues.created_at as "date",
DATEDIFF(closed.created_at, issues.created_at) AS "days_to_close"
FROM issues
JOIN
(SELECT * FROM issue_events
WHERE issue_events.action = "closed") closed
ON issues.id = closed.issue_id
WHERE issues.repo_id = :repoid""")
return pd.read_sql(issuesWithCloseSQL, self.db, params={"repoid": str(repoid)})

def maintainer_response_to_merge_request_duration(self, owner, repo=None):
"""
Duration of time between a merge request being created and a maintainer commenting on that request
Expand Down
1 change: 0 additions & 1 deletion augur/githubapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,6 @@ def contributors_gender(self, owner, repo=None):
genderized = names.merge(LocalCSV.name_gender, how='inner', on=['name'])
return genderized


# def code_reviews(self, owner, repo=None):
# """
# Number of code reviews (merge requests) for a project
Expand Down
36 changes: 36 additions & 0 deletions augur/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -1089,6 +1089,29 @@ def downloaded_repos():
status=200,
mimetype="application/json")

"""
@api {get} /:owner/:repo/timeseries/fakes Fakes
@apiName Fakes
@apiGroup Experimental
@apiDescription This is an Augur-specific metric. We are currently working to define these more formally.
@apiParam {String} owner Username of the owner of the GitHub repository
@apiParam {String} repo Name of the GitHub repository
@apiSuccessExample {json} Success-Response:
[
{
"date": "2010-04-09T00:00:00.000Z",
"fakes": 1
},
{
"date": "2010-04-27T00:00:00.000Z",
"fakes": 2
}
]
"""
self.addTimeseries(ghtorrent.fakes, 'fakes')

"""
@api {get} /git/lines_changed/:git_repo_url Lines Changed (minus whitespace)
@apiName LinesChanged
Expand Down Expand Up @@ -1190,6 +1213,19 @@ def downloaded_repos():
@api {get} /ghtorrent_range GHTorrent Date Range
@apiName GhtorrentRange
@apiGroup Utility
@apiDescription Utility endpoint to show the range of dates GHTorrent covers.
@apiSuccessExample {json} Success-Response:
[
{
"date": "2008-04-10T17:25:06-07:00",
"release": "v0.9.1"
},
{
"date": "2008-04-10T17:25:07-07:00",
"release": "v0.9.2"
}
]
"""
@app.route('/{}/ghtorrent_range'.format(AUGUR_API_VERSION))

Expand Down
1 change: 0 additions & 1 deletion docs/api/api_data_BACKUP_61458.js

This file was deleted.

1 change: 0 additions & 1 deletion docs/api/api_data_BASE_61458.js

This file was deleted.

1 change: 0 additions & 1 deletion docs/api/api_data_LOCAL_61458.js

This file was deleted.

1 change: 0 additions & 1 deletion docs/api/api_data_REMOTE_61458.js

This file was deleted.

2 changes: 1 addition & 1 deletion docs/api/api_project.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/api/api_project.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{ "name": "", "version": "0.0.0", "description": "", "sampleUrl": false, "defaultVersion": "0.0.0", "apidoc": "0.3.0", "generator": { "name": "apidoc", "time": "2018-06-15T01:40:38.973Z", "url": "http://apidocjs.com", "version": "0.17.6" }}
{ "name": "", "version": "0.0.0", "description": "", "sampleUrl": false, "defaultVersion": "0.0.0", "apidoc": "0.3.0", "generator": { "name": "apidoc", "time": "2018-06-15T18:44:05.579Z", "url": "http://apidocjs.com", "version": "0.17.6" }}
Expand Down
1 change: 1 addition & 0 deletions docs/doc/api_data.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions docs/doc/api_data.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[ { "success": { "fields": { "Success 200": [ { "group": "Success 200", "optional": false, "field": "varname1", "description": "<p>No type.</p>" }, { "group": "Success 200", "type": "String", "optional": false, "field": "varname2", "description": "<p>With type.</p>" } ] } }, "type": "", "url": "", "version": "0.0.0", "filename": "./api/main.js", "group": "_Users_carterlandis_Documents_Code_augur_docs_api_main_js", "groupTitle": "_Users_carterlandis_Documents_Code_augur_docs_api_main_js", "name": "" }, { "success": { "fields": { "Success 200": [ { "group": "Success 200", "optional": false, "field": "varname1", "description": "<p>No type.</p>" }, { "group": "Success 200", "type": "String", "optional": false, "field": "varname2", "description": "<p>With type.</p>" } ] } }, "type": "", "url": "", "version": "0.0.0", "filename": "./doc/main.js", "group": "_Users_carterlandis_Documents_Code_augur_docs_doc_main_js", "groupTitle": "_Users_carterlandis_Documents_Code_augur_docs_doc_main_js", "name": "" }]
Expand Down
1 change: 1 addition & 0 deletions docs/doc/api_project.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions docs/doc/api_project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{ "name": "", "version": "0.0.0", "description": "", "sampleUrl": false, "defaultVersion": "0.0.0", "apidoc": "0.3.0", "generator": { "name": "apidoc", "time": "2018-06-15T01:49:05.450Z", "url": "http://apidocjs.com", "version": "0.17.6" }}
Expand Down
Loading

0 comments on commit 1cb1f23

Please sign in to comment.