Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed faculty and course labels and made the course name to also show the course number #1214

Merged
merged 18 commits into from
Jul 8, 2024
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
14306dd
adding files
vungc Jun 13, 2024
69519f6
edited html page to take condition for the dash in course, changed th…
vungc Jun 13, 2024
5430227
the function that returns course name, course number and course name …
MImran2002 Jun 13, 2024
67380b5
function for course name and course number with conditions. And edit …
MImran2002 Jun 14, 2024
e2b027d
Course name and course number function with testing added into to ver…
MImran2002 Jun 14, 2024
4d8c6f9
making sure to make html correct to avoid spacing and any attribute e…
MImran2002 Jun 14, 2024
27b03d5
optimize the function and remove unnescessary strings by using truthf…
MImran2002 Jun 14, 2024
36b64ab
move the courseNameAndNumber folder to modals
MImran2002 Jun 14, 2024
448dd49
to consider testing if there is an empty course name
MImran2002 Jun 14, 2024
6a75e2e
added name and abbr, changed coursename into displayName, changed fun…
vungc Jun 18, 2024
8cdbec3
added name and abbr, changed coursename into displayName, changed fun…
vungc Jun 18, 2024
24d4747
added tests to check the displayName function inside the logic files …
vungc Jun 19, 2024
ea1e0fe
Merge branch 'development' into vungc-courses
BrianRamsay Jun 25, 2024
09dca0f
changed displayname function into 'createCourseDisplayName' and chang…
vungc Jun 26, 2024
cde960b
Merge branch 'development' into vungc-courses
BrianRamsay Jul 1, 2024
fe1b2ba
deleted the displayname file from logic since the fucntion has been a…
vungc Jul 8, 2024
c979249
Merge branch 'development' into vungc-courses
BrianRamsay Jul 8, 2024
944bb9f
deleted the line that imports the displayname fike
vungc Jul 8, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion app/logic/serviceLearningCourses.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from app.logic.createLogs import createAdminLog
from app.logic.fileHandler import FileHandler
from app.logic.term import addPastTerm
from app.models.courseNameAndNumber import nameNumCombo

def getSLProposalInfoForUser(user: User) -> Dict[int, Dict[str, Any]]:
"""
Expand All @@ -43,7 +44,7 @@ def getSLProposalInfoForUser(user: User) -> Dict[int, Dict[str, Any]]:

courseDict[course.id] = {"id":course.id,
"creator":f"{course.createdBy.firstName} {course.createdBy.lastName}",
"name":course.courseName if course.courseName else course.courseAbbreviation,
"coursename": nameNumCombo(course.courseName, course.courseAbbreviation),
MImran2002 marked this conversation as resolved.
Show resolved Hide resolved
"faculty": faculty,
"term": course.term,
"status": course.status.status}
Expand Down
17 changes: 17 additions & 0 deletions app/models/courseNameAndNumber.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from app.models import *

def nameNumCombo(name, abbreviation):
MImran2002 marked this conversation as resolved.
Show resolved Hide resolved
'''
This function combines course name and numbers with conditions
inputs: course name, course abbreviation
'''
if name and abbreviation:
return f"{abbreviation} - {name}"
elif not name and not abbreviation:
return ''
elif not name:
return abbreviation
elif not abbreviation:
return name


2 changes: 1 addition & 1 deletion app/templates/serviceLearning/slcManagement.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ <h1 class="text-center mb-2">{{user.firstName}} {{user.lastName}}'s SLC Proposal
<tbody>
{% for course in courseDict %}
<tr>
<td id="name-{{courseDict[course]['id']}}">{{courseDict[course]['name']}}</td>
<td id="name-{{ courseDict[course]['id'] }}">{{courseDict[course]['coursename']}}</td>
<td id="creator-{{courseDict[course]['id']}}">{{courseDict[course]['creator']}}</td>
<td id="faculty-{{courseDict[course]['id']}}">{{courseDict[course]['faculty']|join(", ")}}</td>
<td id="term-{{courseDict[course]['id']}}">{{courseDict[course]['term'].description}}</td>
Expand Down
17 changes: 17 additions & 0 deletions tests/code/test_serviceLearningCourses.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from app.models.courseParticipant import CourseParticipant

from app.logic.serviceLearningCourses import *
from app.models.courseNameAndNumber import nameNumCombo

@pytest.mark.integration
def test_getServiceLearningCoursesData():
Expand All @@ -23,6 +24,7 @@ def test_getServiceLearningCoursesData():
assert 'Spring 2021' in courseDict[2]['term'].description
assert "Scott Heggen" == courseDict[2]['creator']


courseDict = getSLProposalInfoForUser('heggens')
assert 3 in courseDict
assert 'Scott Heggen' in courseDict[3]['faculty']
Expand All @@ -31,6 +33,7 @@ def test_getServiceLearningCoursesData():
assert 'Summer 2021' in courseDict[3]['term'].description
assert "Brian Ramsay" == courseDict[3]['creator']


courseDict = getSLProposalInfoForUser('heggens')
assert 4 in courseDict
assert 'Scott Heggen' not in courseDict[4]['faculty']
Expand All @@ -39,6 +42,20 @@ def test_getServiceLearningCoursesData():
assert 'Spring 2021' in courseDict[4]['term'].description
assert "Scott Heggen" == courseDict[4]['creator']
BrianRamsay marked this conversation as resolved.
Show resolved Hide resolved



@pytest.mark.integration
def test_courseNameandNumber():
'''tests for the successful implementation of combining course name and number to proper format'''

assert 'Databases' == nameNumCombo("Databases", '')
assert 'Databases' == nameNumCombo("Databases", "")
assert 'FRN 103 - Frenchy Help' == nameNumCombo("Frenchy Help", 'FRN 103')
assert 'FRN 103' == nameNumCombo("", 'FRN 103')
assert '' == nameNumCombo("", '')



@pytest.mark.integration
def test_getInstructorCourses():
"""
Expand Down
Loading