generated from allisonhorst/meds-distill-template
-
Notifications
You must be signed in to change notification settings - Fork 5
/
_grading.Rmd
187 lines (146 loc) · 23.1 KB
/
_grading.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
---
title: "_grading"
author: "Ben Best"
date: "11/22/2021"
output: html_document
editor_options:
chunk_output_type: console
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
Lab Submissions:
* [Lab 1. Proposal (Responses) - Google Sheets](https://docs.google.com/spreadsheets/d/1QFQxFqOl4D7yLq765545etyVwZdTIoDC30HIp0BEb8o/edit#gid=1953637063)
* [Lab 3. Github (Responses) - Google Sheets](https://docs.google.com/spreadsheets/d/10JR8JN7iv0jSXpUA63jjK29B656HBrFk3Wmkl--lwRM/edit?resourcekey#gid=1961930663)
* [Lab 2. Time (Responses) - Google Sheets](https://docs.google.com/spreadsheets/d/1bmDsAp7Qs2s_r286Fv81U74IUm0rTtxN2nXie4MB4cI/edit?resourcekey#gid=200359140)
```{r}
librarian::shelf(
dplyr, googledrive, googlesheets4, stringr, tidyr)
#options(gargle_oauth_email = "[email protected]")
# auth_json <- "~/My Drive ([email protected])/private/ben@ecoquants_google-oauth-id_1008311771534.json"
# stopifnot(file.exists(auth_json))
#gs4_auth() # path = auth_json)
lab1_gs <- "https://docs.google.com/spreadsheets/d/1QFQxFqOl4D7yLq765545etyVwZdTIoDC30HIp0BEb8o/edit"
lab2_gs <- "https://docs.google.com/spreadsheets/d/1bmDsAp7Qs2s_r286Fv81U74IUm0rTtxN2nXie4MB4cI/edit"
grades_gs <- "https://docs.google.com/spreadsheets/d/1L6-HGEndXUkDLms55uSc8HKal4RiLJmp-Gv8m38HwIQ/edit"
dir_students <- "~/My Drive ([email protected])/teaching/2021-11 Team Science, MEDS/grades/students"
d_lab1 <- read_sheet(lab1_gs)
d_lab1 <- d_lab1 %>%
filter(`Email Address` != "[email protected]") %>%
mutate(
user_ucsb = `Email Address` %>%
str_replace("@ucsb.edu", "") %>%
str_replace("@bren.ucsb.edu", ""))
d_roster <- d_lab1 %>%
select(user_ucsb, group = `Group project Key`)
write_sheet(d_roster, ss = grades_gs, sheet = "roster")
d_roster_students <- read_sheet(grades_gs, "roster_students")
d_labs <- read_sheet(grades_gs, "labs")
d_student_roster <- d_labs %>%
select(-points_possible, -points_checksum) %>%
filter(
who == "student") %>%
select(-who) %>%
bind_rows(
d_roster %>%
select(user_ucsb)) %>%
expand(user_ucsb, nesting(lab, part)) %>%
drop_na() %>%
mutate(
points = NA)
write_sheet(d_student_roster, ss = grades_gs, sheet = "roster_students")
d_group_roster <- d_lab1 %>%
select(group = `Group project Key`) %>%
group_by(group) %>%
summarize()
write_sheet(d_group_roster, ss = grades_gs, sheet = "roster_groups")
d_group_roster <- read_sheet(ss = grades_gs, sheet = "roster_groups")
d_groups <- read_sheet(ss = grades_gs, sheet = "groups")
d_groups_add <- d_labs %>%
select(-points_possible, -points_checksum) %>%
filter(who == "group") %>%
select(-who) %>%
anti_join(
d_groups %>%
group_by(lab, part) %>%
summarize(),
by = c("lab", "part")) %>%
bind_rows(
d_group_roster) %>%
expand(group, nesting(lab, part)) %>%
drop_na()
d_groups <- d_groups %>%
bind_rows(d_groups_add) %>%
arrange(lab, group, part)
d_groups <- d_groups %>%
left_join(
d_labs %>%
select(lab, part, points_possible),
by = c("lab", "part"))
write_sheet(d_groups, ss = grades_gs, sheet = "groups")
d_students <- read_sheet(grades_gs, "students")
d_students <- d_students %>%
left_join(
d_labs %>%
select(lab, part, points_possible),
by = c("lab", "part"))
write_sheet(d_students, ss = grades_gs, sheet = "students")
d_student_roster <- read_sheet(grades_gs, "roster_students")
d_lab2 <- read_sheet(lab2_gs)
d_student_roster <- d_student_roster %>%
left_join(
d_lab2 %>%
mutate(
email = `Email Address`,
user_ucsb = email %>%
str_replace("@ucsb.edu", "") %>%
str_replace("@bren.ucsb.edu", ""),
time_github = `Link to your time tracking website, i.e. https://{user}.github.io/time`,
user_github = time_github %>%
str_replace("https://(.*?).github.io/.*", "\\1")) %>%
select(user_ucsb, email, user_github),
by = "user_ucsb")
write_sheet(d_student_roster, ss = grades_gs, sheet = "roster_students")
```
```{r}
d_student_roster <- read_sheet(grades_gs, "roster_students")
d_students <- read_sheet(grades_gs, "students")
d_groups <- read_sheet(grades_gs, "groups")
usrs <- d_student_roster$user_ucsb[6:25]
for (usr in usrs){
grp <- d_student_roster %>%
filter(user_ucsb == usr) %>%
pull(group)
email <- d_student_roster %>%
filter(user_ucsb == usr) %>%
pull(email)
d <- d_students %>%
filter(user_ucsb == !!usr) %>%
bind_rows(
d_groups %>%
filter(group == grp)) %>%
select(
lab, part, user_ucsb, group, points, psbl, comments) %>%
arrange(lab, part)
ss <- gs4_create(usr)
write_sheet(d, ss, "Sheet1")
ss %>%
drive_share(
role = "commenter",
type = "user",
emailAddress = email)
}
```
user_ucsb <- "icole"
googlesheets::
dir.create(dir_students, user_ucsb)
aqi_gs <- "https://docs.google.com/spreadsheets/d/1vwFWAwXAuydEDAaZyuY_C7eHka6kntddIG44VvwR0i4/edit"
x <- drive_get(aqi_gs)
x %>%
drive_reveal("permissions")
x %>%
drive_share(
role = "commenter",
type = "user",
emailAddress = "[email protected]")
```