Commit 9c6f8037 authored by Cyril Matthey-Doret's avatar Cyril Matthey-Doret
Browse files

add visibility in collect_forks response

parent 61df3849
Pipeline #328137 passed with stage
in 2 minutes and 25 seconds
...@@ -40,7 +40,7 @@ One way to achieve this is to have the teacher create all private student groups ...@@ -40,7 +40,7 @@ One way to achieve this is to have the teacher create all private student groups
script: [teach_utils/moodle_to_student_groups.py](teach_utils/moodle_to_student_groups.py) script: [teach_utils/moodle_to_student_groups.py](teach_utils/moodle_to_student_groups.py)
usage: `python mootle_to_student_groups.py] students_moodle.csv` usage: `python moodle_to_student_groups.py] students_moodle.csv`
### Gathering all forks of a project ### Gathering all forks of a project
......
...@@ -77,10 +77,15 @@ def get_last_commit_hash( ...@@ -77,10 +77,15 @@ def get_last_commit_hash(
# Commits are sorted in reverse chronological order by default # Commits are sorted in reverse chronological order by default
# Assumes we're in UTC # Assumes we're in UTC
utc = pytz.UTC utc = pytz.UTC
loc_deadline = utc.localize(datetime.fromisoformat(deadline)) if deadline is None:
before_deadline = True
else:
loc_deadline = utc.localize(datetime.fromisoformat(deadline))
for commit in commits: for commit in commits:
commit_date = datetime.fromisoformat(commit["authored_date"]) if deadline is not None:
if (deadline is None) or (commit_date <= loc_deadline): commit_date = datetime.fromisoformat(commit["authored_date"])
before_deadline = commit_date <= loc_deadline
if before_deadline:
return commit["id"] return commit["id"]
return None return None
...@@ -90,10 +95,11 @@ def format_fork_metadata( ...@@ -90,10 +95,11 @@ def format_fork_metadata(
) -> Dict: ) -> Dict:
"""Format and add fields to a fork's metadata. The """Format and add fields to a fork's metadata. The
resulting metadata will have the following fields: resulting metadata will have the following fields:
id, http_url_to_repo, autostart_url, commit, members, group""" id, http_url_to_repo, autostart_url, commit, members, visibility, group"""
meta = { meta = {
"id": fork["id"], "id": fork["id"],
"url": fork["http_url_to_repo"], "url": fork["http_url_to_repo"],
"visibility": fork["visibility"],
"group": fork["namespace"]["full_path"], "group": fork["namespace"]["full_path"],
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment