Skip to content

Bella/classes#141

Merged
isabellahoie merged 47 commits into
masterfrom
bella/classes
Mar 27, 2024
Merged

Bella/classes#141
isabellahoie merged 47 commits into
masterfrom
bella/classes

Conversation

@isabellahoie
Copy link
Copy Markdown
Collaborator

@isabellahoie isabellahoie commented Mar 1, 2024

Implement Group Classes Scraper

Overview

Added back classes models to support classes feature. Added back scraper for classes on Cornell Recreation Website. Also added it to the scheduler to scrape classes every hour.

Changes Made

Created new file with classes models from previous PR. Used Beautiful Soup to scrape classes table on CFC website and populate the models (also from previous PR). Added scraper to scheduler. *Note: I had to scrape classes before anything else because otherwise there was an issue with initializing the database.

Test Coverage

Manually tested the feature using pgAdmin to ensure that the models were populated with the correct data from the CFC website.

Related PRs or Issues (delete if not applicable)

#110
#116

Isabella Hoie added 30 commits April 15, 2023 16:19
…added activity and gym rresolvers to the schema
…added activity and gym rresolvers to the schema
Comment thread src/models/classes.py
id = Column(Integer, primary_key=True)
name = Column(String(), nullable=False)
description = Column(String(), nullable=False)
gyms = relationship("ClassInstance", back_populates="class_")
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 does gyms reference the class_ field in ClassInstsance?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I think the naming is pretty confusing but basically this is where we relate the table "Class" with the name and description of the class to the table "ClassInstance" which is essentially the join table in our many to many relationship between classes and gyms with additional info in the table (i.e. location, instructor, isCanceled, etc). So, in the line of code you are talking about the field "gyms" is associated with many ClassInstance entries in the table, each of has its own "gym_id". Meaning that by the "gyms" field in "Class" being associated with many "ClassInstances" through the "class_" field, it is indirectly associated with many gyms via the "gym_id" in the table for each "class_" entry, hence why it is called "gyms" in the line of code above. What do you think @kidzegeye since you wrote it lol

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.

Oh okay I see, that makes sense.

Copy link
Copy Markdown
Contributor

@sophiestrausberg sophiestrausberg left a comment

Choose a reason for hiding this comment

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

Looks good!

Copy link
Copy Markdown
Contributor

@daisychangm daisychangm left a comment

Choose a reason for hiding this comment

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

Looks good to me!

@isabellahoie isabellahoie merged commit ff15b38 into master Mar 27, 2024
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