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

Refactor DetailedClassInformation #87

Merged
merged 7 commits into from
Mar 20, 2021

Conversation

J-Raymer
Copy link
Contributor

No description provided.

@codecov
Copy link

codecov bot commented Feb 14, 2021

Codecov Report

Merging #87 (837f9b0) into master (58389d3) will increase coverage by 1.27%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #87      +/-   ##
==========================================
+ Coverage   83.85%   85.13%   +1.27%     
==========================================
  Files          10       10              
  Lines         254      269      +15     
  Branches       38       42       +4     
==========================================
+ Hits          213      229      +16     
+ Misses         41       40       -1     
Impacted Files Coverage Δ
src/types.ts 100.00% <ø> (ø)
src/pages/detailedClassInformation/index.ts 100.00% <100.00%> (+2.70%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 58389d3...837f9b0. Read the comment docs.

@J-Raymer J-Raymer linked an issue Feb 16, 2021 that may be closed by this pull request
Comment on lines +58 to +61
// if there is no end string, set idxEnd to where it would be
if (idxEnd == -1) {
idxEnd = requirementsInfo.length;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@keithradford this is a simple solution to the end index, although after looking through a lot of test pages I think this is the best way to handle it for now. It seems to me that occasionally the end string is not included, and I have not been able to find any pages that include any alternative to: 'This course contains prerequisites please see the UVic Calendar for more information'

@VikeLabs VikeLabs deleted a comment from isaaccormack Feb 16, 2021
@J-Raymer J-Raymer closed this Feb 20, 2021
@J-Raymer J-Raymer reopened this Feb 20, 2021
@J-Raymer J-Raymer marked this pull request as draft February 20, 2021 20:26
@J-Raymer J-Raymer changed the title fixes for numberOfLevels and idxEnd, also updated tests and added TODOs Refactor DetailedClassInformation Feb 20, 2021
@J-Raymer J-Raymer linked an issue Feb 20, 2021 that may be closed by this pull request
@J-Raymer J-Raymer marked this pull request as ready for review March 7, 2021 01:33
@J-Raymer J-Raymer requested a review from keithradford March 7, 2021 01:33
if (idx === -1) {
return data;
// regex statement to grab requirements, ignores "restrictions:" title
const regex = new RegExp('^(?!restrictions).*:$', 'i');
Copy link
Collaborator

Choose a reason for hiding this comment

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

is there a reason for using the regex constructor as appose to using a literal? afaik declaring literals are better in terms of performance which would be beneficial for a data parsing function such as this. typically a regex constructor would be used when the expression is dynamic which I don't believe this one is.

const regex = new RegExp('^(?!restrictions).*:$', 'i');

// list of requirement indeces for parsing
let requirementsIdxList = [] as number[];
Copy link
Collaborator

Choose a reason for hiding this comment

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

i think it's better TS practice to declare arrays like: let requirementsIdxList: number[] = []; instead of type casting

requirementsIdxList.forEach((el) => requirementsList.push(requirementsInfo[el]));

// initialize requirements object
let requirements = {} as Requirements;
Copy link
Collaborator

Choose a reason for hiding this comment

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

same here, could be declared like let requirements: Requirements = {};

@J-Raymer J-Raymer requested a review from keithradford March 8, 2021 01:21
Copy link
Collaborator

@keithradford keithradford left a comment

Choose a reason for hiding this comment

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

LGTM, but I'd go through and remove any typecasting if you can. I think it's just better practice to declare types as appose to typecasting. It's like int i = 0; vs. char c = 0; int i = (int)c; in C.
Also, we might have a new branch dev we're merging to, I'm not too sure what's going on there waiting to hear back on that, so if you can hold off on merging until then 👍

@J-Raymer J-Raymer changed the base branch from master to dev March 20, 2021 18:11
@J-Raymer J-Raymer merged commit e9a9e06 into dev Mar 20, 2021
@J-Raymer J-Raymer deleted the joey/refactor-detailedClassInformation branch March 20, 2021 18:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants