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 all 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
18 changes: 17 additions & 1 deletion app/logic/serviceLearningCourses.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,28 @@ 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,
"name": course.courseName,
"abbr": course.courseAbbreviation,
"courseDisplayName": createCourseDisplayName(course.courseName, course.courseAbbreviation),
"faculty": faculty,
"term": course.term,
"status": course.status.status}
return courseDict

def createCourseDisplayName(name, abbreviation):
'''
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

def saveCourseParticipantsToDatabase(cpPreview: Dict[str, Dict[str, Dict[str, List[Dict[str, Any]]]]]) -> None:
for term, terminfo in cpPreview.items():
termObj: Term = Term.get_or_none(description = term) or addPastTerm(term)
Expand Down
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]['courseDisplayName']}}</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
20 changes: 20 additions & 0 deletions tests/code/test_serviceLearningCourses.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

from app.logic.serviceLearningCourses import *


@pytest.mark.integration
def test_getServiceLearningCoursesData():
'''tests for the successful implementation of populating the proposal table'''
Expand All @@ -22,14 +23,18 @@ def test_getServiceLearningCoursesData():
assert "Submitted" == courseDict[2]['status']
assert 'Spring 2021' in courseDict[2]['term'].description
assert "Scott Heggen" == courseDict[2]['creator']
assert "SPN 104 - Spanish Help" == courseDict[2]['courseDisplayName']


courseDict = getSLProposalInfoForUser('heggens')
assert 3 in courseDict
assert 'Scott Heggen' in courseDict[3]['faculty']
assert not ['Brian Ramsay', 'Zach Neill'] == courseDict[3]['faculty']
assert "Approved" == courseDict[3]['status']
assert 'Summer 2021' in courseDict[3]['term'].description
assert "Brian Ramsay" == courseDict[3]['creator']
assert "FRN 103 - Frenchy Help" == courseDict[3]['courseDisplayName']


courseDict = getSLProposalInfoForUser('heggens')
assert 4 in courseDict
Expand All @@ -38,6 +43,21 @@ def test_getServiceLearningCoursesData():
assert "In Progress" == courseDict[4]['status']
assert 'Spring 2021' in courseDict[4]['term'].description
assert "Scott Heggen" == courseDict[4]['creator']
BrianRamsay marked this conversation as resolved.
Show resolved Hide resolved
assert "Testing" == courseDict[4]['courseDisplayName']



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

assert 'Databases' == createCourseDisplayName("Databases", '')
assert 'Databases' == createCourseDisplayName("Databases", "")
assert 'FRN 103 - Frenchy Help' == createCourseDisplayName("Frenchy Help", 'FRN 103')
assert 'FRN 103' == createCourseDisplayName("", 'FRN 103')
assert '' == createCourseDisplayName ("", '')
MImran2002 marked this conversation as resolved.
Show resolved Hide resolved



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