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

E2006. Refactor tree_display_controller.rb #1698

Merged
merged 48 commits into from
Jul 31, 2020
Merged

Conversation

pjloheide
Copy link
Contributor

@pjloheide pjloheide commented Mar 21, 2020

  • Remove unnecessary methods - Search the 45 methods defined in the controller to see where and why they are called. Remove outdated and unused methods, and see where it is fit to merge or replace methods.

  • Save code and avoid DRY issues - In addition to removing unnecessary methods, code should be reduced wherever possible to make the controller smaller and easier to read.

  • Improve understanding - For all necessary, complex methods in the controller, comments should be added to improve understanding of what methods do. This way, future reviewers won't have to search for implementations to understand the functionality when working on other issues.

RPHolloway and others added 30 commits March 14, 2020 21:21
   Rename children_node_ng to get_folder_contents. Change HTML method from POST to GET.
   Remove Tab System getter. Moved to folder contents getter

Refactor children_node_ng
   Rename children_node_ng to get_folder_contents. Change HTML method from POST to GET.
   Remove Tab System getter. Moved to folder contents getter
Remove duplicate functions created by the merge.
…ildren_node_2_ng.

          Note: This object is not a FolderNode, but has the necessary information to populate a FolderNode object.
Comments more clear
Condense functions and make names more clear

(cherry picked from commit ba6c360)
This removes course_node_for_current_ta? and assignment_node_for_current_ta?
Follows the pattern of serialize_folder_to_json
It doesn't seem to be called anywhere.
This new method will replace update_is_available() and update_is_available_2(). This optimization reduces redundant checks on the TA. It should not matter how the TA relates to the instructor. We should only check if the TA has privileges to view this course. If they do then all other checks are not needed.
assignment_or_course_is_available?() takes the place of these 2 methods.
@expertiza-bot
Copy link
Contributor

expertiza-bot commented Mar 21, 2020

1 Message
💬 Thanks for the pull request, and welcome! 🎉 The Expertiza team is excited to review your changes, and you should hear from us soon.

This repository is being automatically checked for code-quality issues using Code Climate.
You can see results for this analysis in the PR status below. Newly introduced issues should be fixed before a pull request is considered ready to review.

Also, please spend some time looking at the instructions at the top of your course project writeup.
If you have any questions, please send email to expertiza-support@lists.ncsu.edu.

✅ Well done.
One or more of your tests do not have expectations or you commented out some expectations.
To avoid shallow tests – tests concentrating on irrelevant, unlikely-to-fail conditions – please write at least one expectation for each test and do not comment out expectations.
Your pull request is more than 500 LoC.
Please make sure you did not commit unnecessary changes, such as schema.rb, node_modules, change logs.
This pull request contains TODO or FIXME task(s); please fix them.

Generated by expertiza-bot

@coveralls
Copy link

Coverage Status

Coverage increased (+3.5%) to 27.799% when pulling 91f62ee on RPHolloway:beta into caf4c6c on expertiza:beta.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage increased (+3.5%) to 27.799% when pulling 91f62ee on RPHolloway:beta into caf4c6c on expertiza:beta.

@coveralls
Copy link

coveralls commented Mar 21, 2020

Coverage Status

Coverage increased (+1.7%) to 44.978% when pulling 022d3b5 on RPHolloway:beta into 59d0c93 on expertiza:beta.

@expertiza-travisci-bot
Copy link

expertiza-travisci-bot commented Mar 21, 2020

Hey @pjloheide,
Your changes look good to me! 🎉

pjloheide and others added 12 commits March 21, 2020 16:06
PR bot doesn't not like these.
Instructors and TA's have access to courses, not individual assignments. It doesn't matter which node is passed in, we only about course access.
Required based off rubric.
Its true it should not redirect to '/tree_display/list', but its probably better to check that it directly renders #list by checking the http status code.
We will check the http status code like the instructor test since no redirect should occur.
This test doesn't use any methods from this class. It is not our job to test 'ta?()'.
@adityag3 adityag3 merged commit 1211ff7 into expertiza:beta Jul 31, 2020
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.

None yet

8 participants