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
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
......
......@@ -77,10 +77,15 @@ def get_last_commit_hash(
# Commits are sorted in reverse chronological order by default
# Assumes we're in 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:
commit_date = datetime.fromisoformat(commit["authored_date"])
if (deadline is None) or (commit_date <= loc_deadline):
if deadline is not None:
commit_date = datetime.fromisoformat(commit["authored_date"])
before_deadline = commit_date <= loc_deadline
if before_deadline:
return commit["id"]
return None
......@@ -90,10 +95,11 @@ def format_fork_metadata(
) -> Dict:
"""Format and add fields to a fork's metadata. The
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 = {
"id": fork["id"],
"url": fork["http_url_to_repo"],
"visibility": fork["visibility"],
"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