Skip to content
GitLab
Explore
Sign in
Learn Renku
Teaching on Renku
Advanced teaching automation
Compare revisions
8786f780c597b356513ebda255386db74388bc79 to 2b4a800e08a5fc1724510904fcf75171ef66d872
Commits on Source (2)
doc: example activity-stats oneliner
· 7a983f18
Cyril Matthey-Doret
authored
Apr 04, 2023
7a983f18
fix: round proportions from activity-stats
· 2b4a800e
Cyril Matthey-Doret
authored
Apr 04, 2023
2b4a800e
Hide whitespace changes
Inline
Side-by-side
docs/oneliners.md
View file @
2b4a800e
...
...
@@ -69,3 +69,10 @@ jq -r 'map({user: .members[].name, group: .group}) | map([.user, .group])[] | @c
```
sh
jq
'.[].members[] |= select((.name != "renku") and (. != null))'
< forks.json
```
*
Identify groups where one student has >90% of contributions:
```
sh
teach-auto activity-stats
--prop
-exclude-users
"teacher_username"
forks.json
\
| jq
'.[].contributions | select(any(.total > 0.9))'
```
teach_auto/activity_stats.py
View file @
2b4a800e
...
...
@@ -58,13 +58,17 @@ def agg_user_contributions(commits: List[Dict[str, Any]], exclude_users: Optiona
contributions
[
author
][
contrib_type
]
+=
changes
contributions
[
author
][
"
commits
"
]
+=
1
for
user
in
exclude_users
:
del
contributions
[
user
]
try
:
del
contributions
[
user
]
except
KeyError
:
pass
if
prop
:
contrib_types
=
[
"
additions
"
,
"
deletions
"
,
"
total
"
,
"
commits
"
]
for
ctype
in
contrib_types
:
total
=
sum
([
contributions
[
u
][
ctype
]
for
u
in
contributions
])
for
author
in
contributions
:
contributions
[
author
][
ctype
]
/=
total
contrib
=
contributions
[
author
][
ctype
]
contributions
[
author
][
ctype
]
=
round
(
contrib
/
total
,
3
)
return
dict
(
contributions
)
...
...