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

feat: implement Course Statuses feature #444

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

ali-vayani
Copy link
Contributor

@ali-vayani ali-vayani commented Nov 20, 2024

okay so i've been working on this PR for the past 2 days and i think i've almost got it. i'm currently having an issue with typescript being mad at me when i'm updating the usersSchedule with the updated course status

the issue is in: courseStatusChange.ts

the specific error is: where i'm getting the error: Type '{ courses: Course[]; id?: string | undefined; name?: string | undefined; hours?: number | undefined; updatedAt?: number | undefined; }' is not assignable to type 'Serialized'.
Types of property 'id' are incompatible.
Type 'string | undefined' is not assignable to type 'string'.
Type 'undefined' is not assignable to type 'string'.ts(2322)
and has to do when I'm updating the schedule.

i'm get why it's concerned about it potentially being undefined, but there is no possible way it can be undefined since the currentSchedule.map returns a course with the course type.

lmk if you have any questions, i've bunch of random things, but nothing seems to work.

also, FYI, ik the code is super messy rn, I'm just trying to get everything to work and then I'll clean it up


This change is Reviewable

Copy link

Your pull request title did not conform to conventional commits standards. Our upcoming automated release pipeline will automatically determine
the proper release version based on your pull request title.
Cheat Sheet

  • feat: A new feature
  • fix: A bug fix
  • docs: Documentation only changes
  • style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
  • refactor: A code change that neither fixes a bug nor adds a feature
  • perf: A code change that improves performance
  • test: Adding missing tests or correcting existing tests
  • build: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
  • ci: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
  • chore: Other changes that don't modify src or test files
  • revert: Reverts a previous commit

1 similar comment
Copy link

Your pull request title did not conform to conventional commits standards. Our upcoming automated release pipeline will automatically determine
the proper release version based on your pull request title.
Cheat Sheet

  • feat: A new feature
  • fix: A bug fix
  • docs: Documentation only changes
  • style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
  • refactor: A code change that neither fixes a bug nor adds a feature
  • perf: A code change that improves performance
  • test: Adding missing tests or correcting existing tests
  • build: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
  • ci: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
  • chore: Other changes that don't modify src or test files
  • revert: Reverts a previous commit

@doprz doprz changed the title (DRAFT) feat: implement Course Statuses feature feat: implement Course Statuses feature Nov 20, 2024
@doprz doprz marked this pull request as draft November 20, 2024 20:00
@doprz doprz marked this pull request as ready for review November 20, 2024 20:01
@ali-vayani ali-vayani marked this pull request as draft November 20, 2024 20:01
@doprz doprz marked this pull request as ready for review November 20, 2024 20:02
@doprz doprz marked this pull request as draft November 20, 2024 20:02
@doprz doprz added this to the v2.1.0 milestone Nov 20, 2024
@@ -115,6 +115,7 @@ const splashText: string[] = [
`It's ${new Date().toLocaleString('en-US', { month: 'long', day: 'numeric' })} and OU still sucks`,
'As seen on TV! ',
"Should you major in Compsci? well, here's a better question. do you wanna have a bad time?",
"https://i.redd.it/4y3fc2bzva1e1.gif",
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is not related to this PR in addition that we shouldn't include random links. Please remove.

import { resolve } from "path";


export default async function checkCourseStatusChanges() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Needs jsdoc.

@@ -0,0 +1,67 @@
import { UserScheduleStore } from "src/shared/storage/UserScheduleStore";
Copy link
Collaborator

Choose a reason for hiding this comment

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

Use path alias.

Comment on lines +34 to +35
const scrapedStatus = scraper.getStatus(row)[0];
newStatus = scrapedStatus as StatusType;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Ideally we should have some validation here.

const scrapedStatus = scraper.getStatus(row)[0];
newStatus = scrapedStatus as StatusType;
}
console.log('Unique ID:', uniqueId);
Copy link
Collaborator

Choose a reason for hiding this comment

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

This should have some further context if needed for logging. Otherwise this is just verbose and should be removed.

import SettingsIcon from '~icons/material-symbols/settings';
import checkCourseStatusChanges from 'src/pages/background/handler/courseStatusChange';
Copy link
Collaborator

Choose a reason for hiding this comment

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

Use path alias.

Comment on lines +102 to +104
useEffect(() => {
console.log(enableCourseStatusChips, "settings");
},[enableCourseStatusChips])
Copy link
Collaborator

Choose a reason for hiding this comment

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

debug console.log. Should be removed later on.

@@ -138,7 +141,7 @@ export default function Settings(): JSX.Element {
// Listen for changes in the settings
const l1 = OptionsStore.listen('enableCourseStatusChips', async ({ newValue }) => {
setEnableCourseStatusChips(newValue);
// console.log('enableCourseStatusChips', newValue);
console.log('enableCourseStatusChips', newValue);
Copy link
Collaborator

Choose a reason for hiding this comment

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

debug console.log. Should be removed later on.

@@ -211,7 +211,7 @@ export class CourseCatalogScraper {
*/
getInstructionMode(row: HTMLTableRowElement): InstructionMode {
const text = (row.querySelector(TableDataSelector.INSTRUCTION_MODE)?.textContent || '').toLowerCase();

Copy link
Collaborator

Choose a reason for hiding this comment

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

Random indentation.

{/* <button className='inline-block h-4 w-4 bg-transparent p-0 btn'>
<button
className='inline-block h-4 w-4 bg-transparent p-0 btn'
onClick={async () => await checkCourseStatusChanges()}
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit. I would extract this into a dedicated function.

Copy link
Collaborator

Choose a reason for hiding this comment

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

how is this any different from onClick={checkCourseStatusChanges}?

@doprz
Copy link
Collaborator

doprz commented Nov 20, 2024

Also please make sure that all checks are passing.

@DereC4 DereC4 linked an issue Nov 22, 2024 that may be closed by this pull request
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEATURE] Implement Course Statuses
3 participants