Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
Boeing OpenEdX Data Pipeline
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
CS 5934 Team 2 (Blacksburg)
Boeing OpenEdX Data Pipeline
Compare revisions
e0a694434e6e8713f051a9fcdd67fcf554908249 to d2583a873ec21bed4e196d7efb03e0741085de26
Compare revisions
Changes are shown as if the
source
revision was being merged into the
target
revision.
Learn more about comparing revisions.
Source
boeing-capstone-project-a/boeing-openedx-data-pipeline
Select target project
No results found
d2583a873ec21bed4e196d7efb03e0741085de26
Select Git revision
Branches
main
Swap
Target
boeing-capstone-project-a/boeing-openedx-data-pipeline
Select target project
boeing-capstone-project-a/boeing-openedx-data-pipeline
1 result
e0a694434e6e8713f051a9fcdd67fcf554908249
Select Git revision
Branches
main
Show changes
Only incoming changes from source
Include changes to target since source was created
Compare
Commits on Source (2)
Make pipeline robust
· 8d680fb8
Chris Lattman
authored
1 year ago
and
Sydney May
committed
1 year ago
8d680fb8
Merge branch 'make-pipeline-robust' into 'main'
· d2583a87
Sydney May
authored
1 year ago
Make pipeline robust See merge request
!9
d2583a87
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
service/pipeline.py
+24
-23
24 additions, 23 deletions
service/pipeline.py
with
24 additions
and
23 deletions
service/pipeline.py
View file @
d2583a87
...
...
@@ -24,7 +24,7 @@ while True:
start_time
=
time
()
# Get emails, student IDs, and usernames of students (excludes default users and instructors)
query
=
(
"
SELECT id, username, email FROM auth_user WHERE last_login IS NOT NULL AND is_superuser = 0
"
)
query
=
(
"
SELECT id, username, email FROM auth_user WHERE last_login IS NOT NULL AND is_superuser = 0
AND is_staff = 0 AND is_active = 1
"
)
mysql_cursor
.
execute
(
query
)
student_dict
=
{}
for
(
id
,
username
,
email
)
in
mysql_cursor
:
...
...
@@ -112,28 +112,29 @@ while True:
json_data
=
[]
index
=
0
for
student_id
in
student_dict
:
json_data
.
append
({})
json_data
[
index
][
"
Email
"
]
=
student_dict
[
student_id
][
1
]
json_data
[
index
][
"
Username
"
]
=
student_dict
[
student_id
][
0
]
json_data
[
index
][
"
Overall Grade
"
]
=
str
(
student_dict
[
student_id
][
2
])
grade_data
=
student_dict
[
student_id
][
3
]
quiz_ids_ordered
=
[]
for
quiz_id
in
grade_data
:
quiz_name
=
quiz_id_to_quiz_name
[
quiz_id
]
grades
=
grade_data
[
quiz_id
]
json_data
[
index
][
"
Grade on
"
+
quiz_name
]
=
str
(
grades
[
0
])
quiz_ids_ordered
.
append
(
quiz_id
)
for
quiz_id
in
quiz_ids_ordered
:
quiz_name
=
quiz_id_to_quiz_name
[
quiz_id
]
question_grades
=
grade_data
[
quiz_id
][
1
]
question_grades_length
=
len
(
question_grades
)
question_index
=
0
while
question_index
<
question_grades_length
:
question_index_string
=
str
(
int
(
question_index
/
2
)
+
1
)
json_data
[
index
][
quiz_name
+
"
- Q
"
+
question_index_string
+
"
(Earned)
"
]
=
str
(
question_grades
[
question_index
])
json_data
[
index
][
quiz_name
+
"
- Q
"
+
question_index_string
+
"
(Possible)
"
]
=
str
(
question_grades
[
question_index
+
1
])
question_index
+=
2
index
+=
1
if
len
(
student_dict
[
student_id
])
==
4
:
# Ensures that we can access all list elements below
json_data
.
append
({})
json_data
[
index
][
"
Email
"
]
=
student_dict
[
student_id
][
1
]
json_data
[
index
][
"
Username
"
]
=
student_dict
[
student_id
][
0
]
json_data
[
index
][
"
Overall Grade
"
]
=
str
(
student_dict
[
student_id
][
2
])
grade_data
=
student_dict
[
student_id
][
3
]
quiz_ids_ordered
=
[]
for
quiz_id
in
grade_data
:
quiz_name
=
quiz_id_to_quiz_name
[
quiz_id
]
grades
=
grade_data
[
quiz_id
]
json_data
[
index
][
"
Grade on
"
+
quiz_name
]
=
str
(
grades
[
0
])
quiz_ids_ordered
.
append
(
quiz_id
)
for
quiz_id
in
quiz_ids_ordered
:
quiz_name
=
quiz_id_to_quiz_name
[
quiz_id
]
question_grades
=
grade_data
[
quiz_id
][
1
]
question_grades_length
=
len
(
question_grades
)
question_index
=
0
while
question_index
<
question_grades_length
:
question_index_string
=
str
(
int
(
question_index
/
2
)
+
1
)
json_data
[
index
][
quiz_name
+
"
- Q
"
+
question_index_string
+
"
(Earned)
"
]
=
str
(
question_grades
[
question_index
])
json_data
[
index
][
quiz_name
+
"
- Q
"
+
question_index_string
+
"
(Possible)
"
]
=
str
(
question_grades
[
question_index
+
1
])
question_index
+=
2
index
+=
1
with
open
(
"
csvToPy.json
"
,
"
w
"
)
as
json_file
:
dump
(
json_data
,
json_file
,
indent
=
2
)
...
...
This diff is collapsed.
Click to expand it.