Skip to content

Fixing the List of Summer Terms on the Request Summer Proposal page - #1767

Open
ArtemKurasov wants to merge 17 commits into
developmentfrom
1747_Bright_Artem
Open

Fixing the List of Summer Terms on the Request Summer Proposal page#1767
ArtemKurasov wants to merge 17 commits into
developmentfrom
1747_Bright_Artem

Conversation

@ArtemKurasov

@ArtemKurasov ArtemKurasov commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Issue Description

Fixes issue #1747

  • If you request a summer proposal on a CCE Minor Profile page, you don't have enough Summer terms to choose from

Changes

  • There are now more Summer Terms options for the CCE Minor Proposal Form
  • The options reflect the academic year of a student (for example, if they are a freshman, they will 4 options, but if they are not, they will have less).

Testing

  1. Go to Admin > Minor Management
  2. Choose different students on the CCE Minor Progress list/table
  3. Click on the Request Summer Proposal button
  4. Click on the Summer Year dropdown
  5. Make sure that the displayed years match the Student's academic year

@ArtemKurasov
ArtemKurasov marked this pull request as ready for review July 17, 2026 15:53
@brightfietsop-ux

brightfietsop-ux commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Fixes issue ##1747

Summary

Updated the CCE Minor Summer Experience form so students see summer years based on their estimated enrollment period.

What Changed

  • Added selectAllSummerTerms() to estimate a student’s admission year using:
    • Current class level
    • Current academic term
    • Graduation status
  • Limited the dropdown to summers within the student’s estimated enrollment window.
  • Included the current summer when the student is still enrolled.
  • Prevented graduated students from receiving summer options.
  • Updated dropdown options to use explicit Term IDs.
  • Removed unused or broken JavaScript references from the form.
  • Added Summer 2018–2020 to the demo/test data using non-conflicting IDs.

For example, a Senior in Summer 2021 sees Summer 2018–2021, while a Sophomore sees Summer 2020–2022.

Testing

Added tests covering:

  • Freshman, Sophomore, and Senior enrollment windows
  • Current-summer behavior
  • Graduated students
  • Missing or unrecognized class levels
  • Exclusion of summers beyond the estimated graduation window

return redirect(url_for('minor.viewCceMinor', username=username, tab="manageProposals"))

student = User.get_by_id(username)
year_name = User.rawClassLevel

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be classLevel instead of year_name

flash("Proposal successfully created.", "success")
return redirect(url_for('minor.viewCceMinor', username=username, tab="manageProposals"))

student = User.get_by_id(username)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

incase username is not student I know this is not the case above it should be as cceMinor is reserve for students only so we need to ensure isStudent is user here

Comment thread app/logic/utils.py
"""
Select the summer terms during which a CCE Minor student could be enrolled.

The user record does not store an admission date, so the admission academic

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

docstrings should give a reason for input and what returns and a single sentence of what it should do.

Comment thread app/logic/utils.py
"Sophomore": 2,
"Junior": 3,
"Senior": 4,
"Graduating": 5,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

graduating is troublesome classLevel because when you run this command: SELECT * FROM user AS u WHERE u.rawClassLevel = 'Graduating' AND u.isGraduated = TRUE; you will see those two attributes can occur at the same time.

{{ super() }}
<script type="module" src="/static/js/minorProfilePage.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.inputmask/3.3.4/jquery.inputmask.bundle.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.5.4/bootstrap-select.js"></script>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are these remove?

Comment thread tests/code/test_utils.py
],
)
def test_selectAllSummerTerms_uses_estimated_enrollment_window(
class_level, current_description, current_year, expected_years):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make sure to test graduating too as you have special logic for graduating when populating for the student.

@ArtemKurasov ArtemKurasov removed their assignment Sep 8, 2026
@github-actions

Copy link
Copy Markdown

View Code Coverage

Comment thread app/logic/utils.py

firstSummer = inferredAdmissionYear + 1
lastSummer = inferredAdmissionYear + max(4, classYear) - 1
if currentTerm.description.startswith("Summer"):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

currentTerm.isSummer should and can be use here as we have a field for this.

Comment thread app/logic/utils.py
# A Spring/Summer term belongs to the academic year that began the prior fall.
academicYearStart = (currentTerm.year if currentTerm.description.startswith("Fall")
else currentTerm.year - 1)
inferredAdmissionYear = academicYearStart - (classYear - 1)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what we can do here is a way to shrink these lines 63,65,66 to two lines in two of these forms:

eg 1:
firstSummer = (academicYearStart - (classYear - 1)) + 1
lastSummer = (firstSummer - 1) + max(4, classYear) - 1

eg2:


firstSummer, lastSummer = inferredAdmissionYear + 1, inferredAdmissionYear + max(4, classYear) - 1```

{% endif %}
{% for term in selectableTerms %}
<option value="{{ term }}"
<option value="{{ term.id }}"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image changing it from term to term.id doesn't really matter as i tried doing {{ term.description }}, {{term}}, {{term.id}} and term and term.id are the same.

Comment thread tests/code/test_utils.py
@@ -1,6 +1,9 @@
import pytest
from types import SimpleNamespace

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we do not use SimpleNamespace unless we are trying to let's say fake a request in the test so that we can avoid create a whole class for it. For instance: mockRequestProposalObject = SimpleNamespace(
form=defaultProposal,
files=SimpleNamespace(
getlist=lambda key: [],
get=lambda key: None
), in test_nimor.py file. Here your simplenamespace is just use to convert traditional dictionary access into attribute access. but, if my understanding is wrong and there is a rationale do tell me that can change my comment.

Comment thread tests/code/test_utils.py
isCurrentTerm=False,
termOrder=f"{year}-2")

student = SimpleNamespace(rawClassLevel=class_level,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From the above comment regarding simplenamespace convert those so that it reflects the dictionary usage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants