Skip to content

Add enrollment-level learning in public disable capability#150

Merged
alexeygrigorev merged 5 commits into
mainfrom
copilot/disable-learning-in-public
Jan 30, 2026
Merged

Add enrollment-level learning in public disable capability#150
alexeygrigorev merged 5 commits into
mainfrom
copilot/disable-learning-in-public

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 29, 2026

Adds ability to disable learning in public submissions for abusive users at the enrollment level. When disabled, all existing LiP scores are zeroed, future submissions are excluded from scoring, and the LiP form fields are hidden from the user interface.

Changes

Data Model

  • Added Enrollment.disable_learning_in_public boolean field (default: False)
  • Migration 0026 adds field to existing enrollments

Scoring Logic

  • update_learning_in_public_score(): Returns 0 when enrollment.disable_learning_in_public is set
  • score_project(): Skips LiP calculation for both project submissions and peer reviews when flag is enabled

UI Form Hiding

  • Homework submission pages: Learning in public form fields hidden when flag is enabled
  • Project submission pages: Learning in public form fields hidden when flag is enabled
  • Peer review pages: Learning in public form fields hidden when flag is enabled
  • Updated learning_in_public_links.html template to conditionally render based on the flag

Cadmin Interface

  • /cadmin/<course>/enrollments/: List view with LiP status indicators, optimized with annotate(Count()) to avoid N+1
  • /cadmin/<course>/enrollment/<id>/edit: Toggle LiP with atomic score zeroing + leaderboard recalc
  • Leaderboard entries show admin-only link to enrollment management (staff users only)

Score Zeroing Implementation
When disabling, bulk updates homework and project submissions:

# Zero homework LiP scores
for submission in homework_submissions:
    submission.learning_in_public_score = 0
    submission.total_score = submission.questions_score + submission.faq_score
    
# Zero project LiP scores  
for submission in project_submissions:
    submission.project_learning_in_public_score = 0
    submission.peer_review_learning_in_public_score = 0
    submission.total_score = submission.project_score + submission.project_faq_score + ...

Leaderboard is recalculated via update_leaderboard() after score modifications.

Original prompt

This section details on the original issue you should resolve

<issue_title>Punish misusing learning in public</issue_title>
<issue_description>I want to have an ability to disable learning in public for some people who abused the system and used wrong links for that

I want to disable learning in public on the enrollment level. When enrollment is disabled, all learning in public scores are removed, and the user can no longer submit future learning in public links. (So we need a flag for that)

We of course will also need to recalculate the leaderboard

It should be triggered from cadmin and I should have an admin only link from the leaderboard record to enrollment management page in cadmin</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 3 commits January 29, 2026 20:28
Co-authored-by: alexeygrigorev <875246+alexeygrigorev@users.noreply.github.com>
Co-authored-by: alexeygrigorev <875246+alexeygrigorev@users.noreply.github.com>
Co-authored-by: alexeygrigorev <875246+alexeygrigorev@users.noreply.github.com>
Copilot AI changed the title [WIP] Add ability to disable learning in public for users Add enrollment-level learning in public disable capability Jan 29, 2026
Copilot AI requested a review from alexeygrigorev January 29, 2026 20:40
@alexeygrigorev
Copy link
Copy Markdown
Member

@copilot let's also check it when rendering the homework and projects pages. If this flag is set we simply don't display the learning in public forms for homeworks, project submissions and project reviews

Co-authored-by: alexeygrigorev <875246+alexeygrigorev@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Jan 29, 2026

@copilot let's also check it when rendering the homework and projects pages. If this flag is set we simply don't display the learning in public forms for homeworks, project submissions and project rev...

Done in commit d1358c3. The learning in public forms are now hidden on all submission pages (homework, project submission, and peer reviews) when disable_learning_in_public is enabled for the enrollment.

Changes made:

  • Modified homework_view() and context builder to pass disable_learning_in_public flag
  • Modified project_view() to pass disable_learning_in_public flag
  • Modified projects_eval_submit() and context builder to pass disable_learning_in_public flag
  • Updated learning_in_public_links.html template to check the flag: {% if learning_in_public_cap > 0 and not disable_learning_in_public %}

When the flag is set, students won't see the learning in public input fields at all.

@alexeygrigorev alexeygrigorev marked this pull request as ready for review January 29, 2026 22:32
@alexeygrigorev alexeygrigorev merged commit e2c50ff into main Jan 30, 2026
2 checks passed
@alexeygrigorev alexeygrigorev deleted the copilot/disable-learning-in-public branch January 30, 2026 05:45
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.

Punish misusing learning in public

2 participants