Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Olivier
Peer-graded student exercises
Commits
c3bea133
Commit
c3bea133
authored
Jul 25, 2019
by
Olivier
Browse files
M6: G-code for peers now has an "A" or a "B" suffix
parent
2e29a0c1
Changes
1
Hide whitespace changes
Inline
Side-by-side
M6_match_peers/match_peers.py
View file @
c3bea133
...
...
@@ -59,8 +59,8 @@ ID_G_peer2 = ['']*len(custom_ID_G)
for
i
in
range
(
0
,
len
(
custom_ID_G
)):
# Only students who submitted solution can recieve a peer role
if
did_their_homework
[
i
]
==
True
:
random_peers1
.
append
(
custom_ID_G
[
i
])
random_peers2
.
append
(
custom_ID_G
[
i
])
random_peers1
.
append
(
custom_ID_G
[
i
]
+
'A'
)
random_peers2
.
append
(
custom_ID_G
[
i
]
+
'B'
)
copy_randp1
=
random_peers1
# Save a copy of the array "random_peers1"
copy_randp2
=
random_peers2
# Save a copy of the array "random_peers2"
...
...
@@ -80,11 +80,11 @@ while counter<len(names) and iterations<10000:
iterations
=
iterations
+
1
# Update iterations counter
continue
# This jumps to the begining of the while loop
# Make sure that the last student in the list does not end up wihout a
peer,
# in the case that the last peer to be assigned is themselves.
if
len
(
random_peers1
)
==
1
and
(
custom_ID_G
[
counter
]
==
random_peers1
[
0
]
or
custom_ID_G
[
counter
]
==
random_peers2
[
0
]
or
random_peers1
[
0
]
==
random_peers2
[
0
]):
# Make sure that the last student in the list does not end up wi
t
hout a
#
peer,
in the case that the last peer to be assigned is themselves.
if
len
(
random_peers1
)
==
1
and
(
custom_ID_G
[
counter
]
==
random_peers1
[
0
]
[
0
:
-
1
]
or
custom_ID_G
[
counter
]
==
random_peers2
[
0
]
[
0
:
-
1
]
or
random_peers1
[
0
]
[
0
:
-
1
]
==
random_peers2
[
0
]
[
0
:
-
1
]
):
random_peers1
=
copy_randp1
# Resets "random_peers1" array
random_peers2
=
copy_randp2
# Resets "random_peers2" array
counter
=
0
# This resets counter
...
...
@@ -92,9 +92,9 @@ while counter<len(names) and iterations<10000:
continue
# If student==peer or peer1==peer2 repeat iteration
if
(
custom_ID_G
[
counter
]
==
random_peers1
[
0
]
or
custom_ID_G
[
counter
]
==
random_peers2
[
0
]
or
random_peers1
[
0
]
==
random_peers2
[
0
]):
if
(
custom_ID_G
[
counter
]
==
random_peers1
[
0
]
[
0
:
-
1
]
or
custom_ID_G
[
counter
]
==
random_peers2
[
0
]
[
0
:
-
1
]
or
random_peers1
[
0
]
[
0
:
-
1
]
==
random_peers2
[
0
]
[
0
:
-
1
]
):
iterations
=
iterations
+
1
# Update iterations counter
continue
# "counter" is not updated, iteration will be repeated
...
...
@@ -113,7 +113,7 @@ while counter<len(names) and iterations<10000:
with
open
(
peers_csv_path
,
'w'
,
newline
=
''
)
as
f
:
writer
=
csv
.
writer
(
f
)
writer
.
writerow
([
'name'
,
'lastname'
,
'email'
,
'custom_ID_A'
,
'custom_ID_G'
,
'submitted'
,
'peer1_ID
_G
'
,
'peer2_ID
_G
'
])
'submitted'
,
'peer1_ID'
,
'peer2_ID'
])
for
i
in
range
(
0
,
len
(
names
)):
writer
.
writerow
([
names
[
i
],
last_name
[
i
],
emails
[
i
],
custom_ID_A
[
i
],
custom_ID_G
[
i
],
str
(
did_their_homework
[
i
]),
ID_G_peer1
[
i
],
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment