-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* update generated client and add tests * add user module with example and docs * add changelog entry and fix other PR numbers * Merge remote-tracking branch 'origin/master' into user-client * Update Changelog.md
- Loading branch information
Showing
43 changed files
with
2,325 additions
and
118 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Logged User Times | ||
|
||
This example uses the [`User` class](../../api/webknossos/client/user.md#User) to load the logged times | ||
for all users of whom the current user is admin or team-manager. | ||
|
||
*This example additionally needs the pandas and tabulate packages.* | ||
|
||
```python | ||
--8<-- | ||
webknossos/examples/user_times.py | ||
--8<-- | ||
``` | ||
|
||
This results in an output similar to | ||
|
||
``` | ||
Logged User Times 2021: | ||
| email | 1 | 2 | 3 | 4 | 5 | 6 | 7 | | ||
|:-----------------------|-----:|-----:|-----:|-----:|----:|----:|----:| | ||
| [email protected] | 0 | 0 | 0 | 0 | 0 | 0 | 0 | | ||
| [email protected] | 0 | 0 | 16 | 210 | 0 | 271 | 150 | | ||
| [email protected] | 0 | 0 | 553 | 0 | 0 | 0 | 0 | | ||
| [email protected] | 0 | 0 | 0 | 1746 | 0 | 0 | 486 | | ||
| [email protected] | 36 | 0 | 158 | 0 | 20 | 0 | 452 | | ||
| [email protected] | 0 | 260 | 674 | 903 | 0 | 541 | 0 | | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import pandas as pd | ||
|
||
import webknossos as wk | ||
|
||
df = pd.DataFrame() | ||
df.columns = pd.MultiIndex([[], []], [[], []], names=("year", "month")) | ||
df.index.name = "email" | ||
|
||
users = wk.User.get_all_managed_users() | ||
for user in users: | ||
for logged_time in user.get_logged_times(): | ||
df.loc[ | ||
user.email, (logged_time.year, logged_time.month) | ||
] = logged_time.duration_in_seconds | ||
|
||
df = df.fillna(0).astype("uint") | ||
df = df.sort_index(axis="index").sort_index(axis="columns") | ||
|
||
year = 2021 | ||
has_logged_times_in_year = df.loc[:, year].sum(axis="columns") != 0 | ||
|
||
print(f"Logged User Times {year}:\n") | ||
print(df.loc[has_logged_times_in_year, year].to_markdown()) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.