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

Export files inside nested directories #2091

Merged
merged 6 commits into from
Feb 24, 2024
Merged

Conversation

coder6583
Copy link
Contributor

@coder6583 coder6583 commented Feb 17, 2024

Description

  • Export files inside nested directories when exporting assessments and courses
  • Filters out the handin directory when exporting

Motivation and Context

  • When the course had directories that had nested files, the files weren't showing up.
image

↑ A nested file in the course directory
image

↑ No file

How Has This Been Tested?

  • Created an assessment with a writeup directory containing a pdf file
  • Handed in a few files to the assessment to create files inside the handin directory
  • Exported assessment and course with assessments

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • I have run rubocop and erblint for style check. If you haven't, run overcommit --install && overcommit --sign to use pre-commit hook for linting

Other issues / help required

Should I use Find.find over Dir[].each?

If unsure, feel free to submit first and we'll help you along.

Copy link
Contributor

coderabbitai bot commented Feb 17, 2024

Walkthrough

Walkthrough

The recent update introduces a method to recursively load directories into a tar archive, enhancing the export functionality for both assessments and courses by allowing for more structured file organization with optional filtering. Additionally, database schema adjustments were made, including changes to column types and sizes, and the introduction of new columns while removing or altering defaults for others.

Changes

File Path Change Summary
app/controllers/.../assessments_controller.rb Refactored file export logic to use load_dir_to_tar with file selection filter.
app/models/assessment.rb Added load_dir_to_tar method for recursive directory loading into tar with filtering.
app/models/course.rb Refactored generate_tar to use load_dir_to_tar for directory loading with a filter.
db/schema.rb Modified column types and sizes, reordered columns, added/removed columns, and adjusted limits.

Related issues

  • Assessment export does not include subdirectories #2054: The issue discusses the lack of support for nested directories in assessment exports. The newly introduced load_dir_to_tar method addresses this by enabling recursive loading of directories, which could potentially resolve the issue's objectives by allowing for more complex file structures in exports.

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share

Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit-tests for this file.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit tests for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository from git and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

@gitstream-cm gitstream-cm bot requested review from a team and KesterTan and removed request for a team February 17, 2024 19:04
@gitstream-cm gitstream-cm bot added small Pull request is small waiting-for-review labels Feb 17, 2024
app/models/assessment.rb Show resolved Hide resolved
app/controllers/assessments_controller.rb Outdated Show resolved Hide resolved
app/controllers/assessments_controller.rb Outdated Show resolved Hide resolved
db/schema.rb Outdated Show resolved Hide resolved
db/schema.rb Outdated Show resolved Hide resolved
db/schema.rb Outdated Show resolved Hide resolved
@KesterTan
Copy link
Contributor

I think in this case, it should be fine to not use Find.find since you're already disabling handins

@KesterTan
Copy link
Contributor

Looks good so far, but I think we can perhaps consider adding a toggle so that people can choose if they want to download handins or not.

app/models/course.rb Outdated Show resolved Hide resolved
Copy link
Contributor

@KesterTan KesterTan left a comment

Choose a reason for hiding this comment

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

LGTM

@coder6583 coder6583 added this pull request to the merge queue Feb 24, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Feb 24, 2024
@coder6583 coder6583 added this pull request to the merge queue Feb 24, 2024
Merged via the queue into master with commit c68e7a3 Feb 24, 2024
5 checks passed
@coder6583 coder6583 deleted the somanarita-export-nested-dir branch February 24, 2024 17:39
@damianhxy damianhxy linked an issue Feb 26, 2024 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
small Pull request is small waiting-for-review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Assessment export does not include subdirectories
3 participants