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

Development: Fix null pointer exception when fetching student participation #8178

Conversation

mateusmm01
Copy link
Contributor

@mateusmm01 mateusmm01 commented Mar 11, 2024

Checklist

General

Changes affecting Programming Exercises

  • High priority: I tested all changes and their related features with all corresponding user types on a test server configured with the integrated lifecycle setup (LocalVC and LocalCI).

Motivation and Context

Currently, Code Editor and Repositories can't be opened if the exercise doesn't have a start or release date.

Description

When fetching a participation, it is first checked if a start date exists before continuing with the checks.

Steps for Testing

Prerequisites:

Test that everything works as expected when opening code editor and repositories for programming exercises without start or release date

Testserver States

Note

These badges show the state of the test servers.
Green = Currently available, Red = Currently locked







Review Progress

Performance Review

  • I (as a reviewer) confirm that the client changes (in particular related to REST calls and UI responsiveness) are implemented with a very good performance
  • I (as a reviewer) confirm that the server changes (in particular related to database calls) are implemented with a very good performance

Code Review

  • Code Review 1
  • Code Review 2

Manual Tests

  • Test 1
  • Test 2

Exam Mode Test

  • Test 1
  • Test 2

Test Coverage

Screenshots

Summary by CodeRabbit

  • Bug Fixes
    • Adjusted access control logic for students to participate in programming exercises, ensuring they can only access the exercises after the start date.
  • Tests
    • Updated programming exercise participation tests to include a releaseDate parameter, enhancing the accuracy of test scenarios.

@artemis-bot artemis-bot added this to In progress in Artemis Development Mar 11, 2024
@github-actions github-actions bot added the server Pull requests that update Java code. (Added Automatically!) label Mar 11, 2024
@mateusmm01 mateusmm01 temporarily deployed to artemis-test6.artemis.cit.tum.de March 11, 2024 13:07 — with GitHub Actions Inactive
@mateusmm01 mateusmm01 marked this pull request as ready for review March 11, 2024 13:12
@mateusmm01 mateusmm01 requested a review from a team as a code owner March 11, 2024 13:12
Copy link

coderabbitai bot commented Mar 11, 2024

Walkthrough

The update focuses on refining the access control logic within a specific method to ensure students can only access participations in programming exercises based on the current time and the exercise start date. This adjustment enhances the precision of access control, aligning access permissions more closely with the timing of the exercise.

Changes

File Path Change Summary
.../web/rest/ProgrammingExerciseParticipationResource.java Modified access control logic in hasAccessToParticipationElseThrow to consider exercise start date and current time.
.../exercise/programmingexercise/ProgrammingExerciseParticipationIntegrationTest.java Added releaseDate parameter to test methods and updated test logic accordingly.

Related issues

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.
    • Open a follow-up GitHub issue for this discussion.
  • 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 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.

@artemis-bot artemis-bot moved this from In progress to Ready for review in Artemis Development Mar 11, 2024
Artemis Development automation moved this from Ready for review to Review in progress Mar 11, 2024
@krusche krusche changed the title Integrated code lifecycle: Fix nullpointer exception when fetching student participation Development: Fix null pointer exception when fetching student participation Mar 11, 2024
@krusche krusche modified the milestones: 6.9.1, 6.9.2 Mar 11, 2024
Copy link
Contributor

@pzdr7 pzdr7 left a comment

Choose a reason for hiding this comment

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

Tested on TS3.

  • As a student, I can open the code editor and repository of a programming exercise even when it has no release date and no start date.
  • Just to be sure, I tested it in an exam as well and encountered no problems.

-> Works as expected!

Copy link
Contributor

@b-fein b-fein left a comment

Choose a reason for hiding this comment

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

Code changes look good

Copy link
Contributor

@laurenzfb laurenzfb left a comment

Choose a reason for hiding this comment

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

code lgtm

Copy link
Contributor

@rstief rstief left a comment

Choose a reason for hiding this comment

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

Code looks good

@mateusmm01 mateusmm01 temporarily deployed to artemis-test6.artemis.cit.tum.de March 11, 2024 21:29 — with GitHub Actions Inactive
@krusche krusche merged commit f213047 into develop Mar 11, 2024
77 of 80 checks passed
@krusche krusche deleted the feature/localvc/fix-nullpointer-exception-when-startdate-not-set-when-fetching-participation branch March 11, 2024 22:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix ready to merge server Pull requests that update Java code. (Added Automatically!) tests
Projects
No open projects
Artemis Development
  
Review in progress
Development

Successfully merging this pull request may close these issues.

Editor (student view) does not display Programming Exercises with an unspecified release date
6 participants