Skip to content

Conversation

@iAmbrosial
Copy link
Contributor

@iAmbrosial iAmbrosial commented Dec 1, 2025

Description

The pattern matching logic for the is_cancelled generated column in the websoc_section table was fixed to correctly identify cancelled sections by parsing the section comment. Additionally, the term has been allowed to either be spelled "cancelled" or "canceled".

The isCancelled boolean field has also been added to the websocSectionSchema Zod Schema with OpenAPI docs, as well as the WebsocSection GraphQL type with documentation. This provides an explicit indicator of cancelled course sections to end users, and takes precedence over the existing status field in the API response.

Related Issues

#266

Also resolves #168

Motivation and Context

The current logic for generating the is_cancelled column is incorrect, leading to misidentification of cancelled class sections. The WebSoc API returns section comments with HTML formatting and extra whitespace, and this did not match the expected pattern matching logic controlling the generated column. This needs to be fixed so that accurate data regarding cancelled classes–both past and future–are output when queried.

We want the end user to be able to access the isCancelled field that indicates whether or not the corresponding class section has been cancelled. This creates a clear indicator for when a section is cancelled while retaining the original class status (e.g. open, full).

How Has This Been Tested?

The Websoc scraper was ran locally to accrue Winter 2026 data.
SQL queries were then run locally.
Migration applied successfully to the local db.

API was run locally and Verified REST and GraphQL queries work on locally run API.

Screenshots (if appropriate):

anteater_api=# SELECT section_code, is_cancelled FROM websoc_section WHERE section_code = 34021 AND year = '2026' AND quarter = 'Winter';
 section_code | is_cancelled 
--------------+--------------
        34021 | t

REST:

> curl --silent "http://localhost:8787/v2/rest/websoc?year=2026&quarter=Winter&sectionCodes=34021" \
| jq ".data.schools[0].departments[0].courses[0].sections[0] | {sectionCode, isCancelled}"

{
  "sectionCode": "34021",
  "isCancelled": true
}

GraphQL:

> echo 'query WebsocTest {
  websoc(query: {
    year: "2026"
    quarter: Winter
    sectionCodes: "34021"
  }) {
    schools {
      departments {
        courses {
          sections {
            sectionCode
            isCancelled
            sectionComment
          }
        }
      }
    }
  }
}' \
| tr -d '\n' \
| jq --raw-input --raw-output --compact-output "{query: .}" \
| curl -s -X POST --data @- "http://localhost:8787/v2/graphql" -H "Content-Type: application/json" \
| jq ".data.websoc.schools[0].departments[0].courses[0].sections[0] | {sectionCode, isCancelled}"
{
  "sectionCode": "34021",
  "isCancelled": true
}

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code involves a change to the database schema.
  • My code requires a change to the documentation.

@laggycomputer
Copy link
Member

Waiting for addition of resolution to #168.

@iAmbrosial
Copy link
Contributor Author

Waiting for addition of resolution to #168.

Addition of resolution to #168 was added to the pr; ready for review.

@iAmbrosial iAmbrosial marked this pull request as ready for review December 2, 2025 21:44
Copy link
Member

@laggycomputer laggycomputer left a comment

Choose a reason for hiding this comment

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

Close now.

Copy link
Member

@laggycomputer laggycomputer left a comment

Choose a reason for hiding this comment

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

Make sure you test this one last time.

Copy link
Collaborator

@sanskarm7 sanskarm7 left a comment

Choose a reason for hiding this comment

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

with the merge of #260, this change will need to have it's migration number updated to 22

@iAmbrosial

@iAmbrosial
Copy link
Contributor Author

with the merge of #260, this change will need to have it's migration number updated to 22

@iAmbrosial

I had some issues with conflicting changes being lumped together locally, but hopefully everything should be correct in the committed migration (which was tested again).

@iAmbrosial iAmbrosial requested a review from sanskarm7 December 18, 2025 20:23
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.

WebSoc is_cancelled column is not correct [WebSoc] Provide indication of cancelled courses

4 participants