Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
autograder-tools
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
akamil
autograder-tools
Commits
40314d38
Commit
40314d38
authored
5 years ago
by
akamil
Browse files
Options
Downloads
Patches
Plain Diff
Add script to compute the final deadlines for a course's projects.
parent
b1c2b685
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
README.md
+10
-0
10 additions, 0 deletions
README.md
ag_tools/final_deadlines.py
+52
-0
52 additions, 0 deletions
ag_tools/final_deadlines.py
setup.py
+1
-0
1 addition, 0 deletions
setup.py
with
63 additions
and
0 deletions
README.md
+
10
−
0
View file @
40314d38
...
...
@@ -227,6 +227,16 @@ $ ag-last-date 25 akamil
The username can be a uniqname or an email address.
## `ag-final-deadlines`
This determines the last deadline for each project in a course, taking
extensions into account. It also lists which projects have an
outstanding deadline. Requires the course ID.
```
console
$
ag-final-deadlines 25
```
## `ag-roster`
This downloads a roster from the autograder or uploads a new one.
...
...
This diff is collapsed.
Click to expand it.
ag_tools/final_deadlines.py
0 → 100755
+
52
−
0
View file @
40314d38
#!/usr/bin/env python3
"""
Determine the date of a student
'
s last submission.
"""
import
datetime
import
click
import
pytz
try
:
import
common
except
:
from
.
import
common
MIN_DATETIME
=
datetime
.
datetime
.
min
.
replace
(
tzinfo
=
common
.
TIMEZONE
)
@click.command
(
context_settings
=
{
'
help_option_names
'
:
[
'
-h
'
,
'
--help
'
]})
@click.argument
(
'
course_id
'
,
type
=
int
,
)
def
main
(
course_id
):
api_token
=
common
.
get_api_token
()
last_date
=
MIN_DATETIME
now
=
pytz
.
utc
.
localize
(
datetime
.
datetime
.
utcnow
())
projects
=
common
.
get_project_list
(
api_token
,
course_id
)
open_projects
=
[]
for
project
in
sorted
(
projects
,
key
=
lambda
p
:
p
[
'
name
'
]):
project_date
=
last_deadline
(
api_token
,
project
)
if
project_date
>
last_date
:
last_date
=
project_date
if
project_date
>
now
:
open_projects
.
append
((
project
,
project_date
))
print
(
f
'
Last deadline for
{
project
[
"
name
"
]
}
:
{
project_date
}
'
)
if
open_projects
:
print
(
'
\n
Open projects:
'
)
for
project
,
project_date
in
open_projects
:
print
(
f
'
{
project
[
"
name
"
]
}
:
{
project_date
}
'
)
else
:
print
(
'
\n
No open projects
'
)
def
last_deadline
(
api_token
,
project
):
"""
Determine time of last deadline or extension for a project.
"""
groups
=
common
.
get_endpoint
(
f
'
projects/
{
project
[
"
pk
"
]
}
/groups/
'
,
api_token
)
due_date
=
common
.
convert_timestamp
(
project
[
'
closing_time
'
])
extensions
=
[
common
.
convert_timestamp
(
group
[
'
extended_due_date
'
])
for
group
in
groups
if
group
.
get
(
'
extended_due_date
'
)]
return
max
(
extensions
+
[
due_date
])
if
__name__
==
'
__main__
'
:
main
()
This diff is collapsed.
Click to expand it.
setup.py
+
1
−
0
View file @
40314d38
...
...
@@ -32,6 +32,7 @@ setup(
'
ag-bonus = ag_tools.ag_bonus:main
'
,
'
ag-copy-groups = ag_tools.copy_groups:main
'
,
'
ag-copy-project = ag_tools.copy_project:main
'
,
'
ag-final-deadlines = ag_tools.final_deadlines:main
'
,
'
ag-finish-handgrading = ag_tools.finish_handgrading:main
'
,
'
ag-get-late-days = ag_tools.get_late_days:main
'
,
'
ag-last-date = ag_tools.last_date:main
'
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment