generated from prof-rossetti/flask-sheets-template-2023
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
70fc80e
commit 7c3f52e
Showing
6 changed files
with
92 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,15 @@ def course(course_id): | |
current_user = session.get("current_user") | ||
email = current_user["email"] | ||
#TODO: change hard coded email to "email" fetched from session | ||
assignments_list = ss.get_course_assignments("[email protected]", course_id) | ||
email = "[email protected]" | ||
################################## | ||
|
||
if current_user.get('user_type') == "student": | ||
assignments_list = ss.get_course_assignments(email, course_id) | ||
return render_template("assignments.html", assignments=assignments_list, course_id=course_id) | ||
elif current_user.get('user_type') == "teacher": | ||
roster_data = ss.get_course_roster(course_id) | ||
return render_template("course_roster.html", roster_data=roster_data) | ||
return render_template("assignments.html", assignments=assignments_list, course_id=course_id) | ||
|
||
|
||
|
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 |
---|---|---|
|
@@ -15,8 +15,11 @@ def courses(): | |
print("USER COURSES...") | ||
current_user = session.get("current_user") | ||
ss = current_app.config["SPREADSHEET_SERVICE"] | ||
|
||
email = current_user["email"] | ||
email = "[email protected]" | ||
|
||
courses = ss.get_student_courses(current_user["email"]) | ||
courses = ss.get_courses(email) | ||
|
||
return render_template("courses.html", courses=courses) | ||
|
||
|
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,47 @@ | ||
{% extends "bootstrap_5_layout.html" %} | ||
{% set active_page = "assignments" %} | ||
|
||
{% block content %} | ||
|
||
<h1>Course Roster</h1> | ||
|
||
<table class="table table-hover text-center"> | ||
<thead> | ||
<tr> | ||
<th scope="col">Last</th> | ||
<th scope="col">First</th> | ||
<th scope="col">Email</th> | ||
<th scope="col">Current Grade</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{% for d in roster_data %} | ||
<tr class="clickable-row" data-href="/courses/{{ course_id }}/student/{{ d.Email }}"> | ||
<td> | ||
{{ d.Last }} | ||
</td> | ||
<td> | ||
{{ d.First }} | ||
</td> | ||
<td> | ||
{{ d.Email }} | ||
</td> | ||
<td> | ||
{{ d.TOTAL }} | ||
</td> | ||
</tr> | ||
{% endfor %} | ||
</tbody> | ||
</table> | ||
|
||
<script> | ||
document.addEventListener("DOMContentLoaded", function(){ | ||
document.querySelectorAll('.clickable-row').forEach(row => { | ||
row.addEventListener('click', function() { | ||
window.location.href = this.dataset.href; | ||
}); | ||
}); | ||
}); | ||
</script> | ||
|
||
{% endblock %} |