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

Correct flow submissions #758

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,6 @@ bulk-storage
/.coverage
/coverage.xml
/.vscode/

__pycache__
local_settings.py
8 changes: 5 additions & 3 deletions course/analytics.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,9 +287,11 @@ def __init__(self, group_id, page_id, title, average_correctness,
self.group_id = group_id
self.page_id = page_id
self.title = title
self.average_correctness_percent = 99.99*average_correctness
self.average_emptiness_percent = 99.99*average_emptiness
self.average_wrongness_percent = 99.99*(

self.pct = 100.0
self.average_correctness_percent = self.pct*average_correctness
self.average_emptiness_percent = self.pct*average_emptiness
self.average_wrongness_percent = self.pct*(
1-average_correctness-average_emptiness)
self.answer_count = answer_count
self.total_count = total_count
Expand Down
2 changes: 1 addition & 1 deletion course/flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -705,7 +705,7 @@ def __init__(

# Rounding to larger than 100% will break the percent bars on the
# flow results page.
Copy link
Owner

Choose a reason for hiding this comment

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

This comment can probably be removed.

Copy link
Owner

Choose a reason for hiding this comment

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

Did you take any measures to prevent the percent bars being fed numbers larger than 100 (e.g. due to rounding)?

FULL_PERCENT = 99.99
FULL_PERCENT = 100.0

# {{{ point percentages

Expand Down
85 changes: 85 additions & 0 deletions course/migrations/0115_auto_20201226_1748.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# Generated by Django 3.0.11 on 2020-12-26 23:48

import course.models
import django.core.validators
from django.db import migrations, models
import jsonfield.fields


class Migration(migrations.Migration):
Copy link
Owner

Choose a reason for hiding this comment

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

Where did this migration come from?


dependencies = [
('course', '0114_alter_helptext_for_ptag_and_prole_fix_typo'),
]

operations = [
migrations.AlterModelOptions(
name='authenticationtoken',
options={'ordering': ('participation', 'creation_time'), 'verbose_name': 'Authentication token', 'verbose_name_plural': 'Authentication tokens'},
),
migrations.AlterField(
model_name='course',
name='identifier',
field=models.CharField(db_index=True, help_text="A course identifier. Alphanumeric with dashes, no spaces. This is visible in URLs and determines the location on your file system where the course's git repository lives. This should <em>not</em> be changed after the course has been created without also moving the course's git on the server.", max_length=200, unique=True, validators=[django.core.validators.RegexValidator('^(?P<course_identifier>[-a-zA-Z0-9]+)$', message="Identifier may only contain letters, numbers, and hyphens ('-').")], verbose_name='Course identifier'),
),
migrations.AlterField(
model_name='event',
name='kind',
field=models.CharField(help_text='Should be lower_case_with_underscores, no spaces allowed.', max_length=50, validators=[django.core.validators.RegexValidator('^(?P<event_kind>[_a-z0-9]+)$', message='Should be lower_case_with_underscores, no spaces allowed.')], verbose_name='Kind of event'),
),
migrations.AlterField(
model_name='flowaccessexception',
name='stipulations',
field=jsonfield.fields.JSONField(blank=True, dump_kwargs={'ensure_ascii': False}, help_text='A dictionary of the same things that can be added to a flow access rule, such as allowed_session_count or credit_percent. If not specified here, values will default to the stipulations in the course content.', null=True, validators=[course.models.validate_stipulations], verbose_name='Stipulations'),
),
migrations.AlterField(
model_name='flowpagebulkfeedback',
name='bulk_feedback',
field=jsonfield.fields.JSONField(blank=True, dump_kwargs={'ensure_ascii': False}, null=True, verbose_name='Bulk feedback'),
),
migrations.AlterField(
model_name='flowpagedata',
name='data',
field=jsonfield.fields.JSONField(blank=True, dump_kwargs={'ensure_ascii': False}, null=True, verbose_name='Data'),
),
migrations.AlterField(
model_name='flowpagevisit',
name='answer',
field=jsonfield.fields.JSONField(blank=True, dump_kwargs={'ensure_ascii': False}, null=True, verbose_name='Answer'),
),
migrations.AlterField(
model_name='flowpagevisitgrade',
name='feedback',
field=jsonfield.fields.JSONField(blank=True, dump_kwargs={'ensure_ascii': False}, null=True, verbose_name='Feedback'),
),
migrations.AlterField(
model_name='flowpagevisitgrade',
name='grade_data',
field=jsonfield.fields.JSONField(blank=True, dump_kwargs={'ensure_ascii': False}, null=True, verbose_name='Grade data'),
),
migrations.AlterField(
model_name='gradingopportunity',
name='identifier',
field=models.CharField(help_text='A symbolic name for this grade. lower_case_with_underscores, no spaces.', max_length=200, validators=[django.core.validators.RegexValidator('^(?P<grading_opp_id>[-_a-zA-Z0-9]+)$', message="Identifier may only contain letters, numbers, and hyphens ('-').")], verbose_name='Grading opportunity ID'),
),
migrations.AlterField(
model_name='participationpermission',
name='permission',
field=models.CharField(choices=[('edit_course', 'Edit course'), ('use_admin_interface', 'Use admin interface'), ('manage_authentication_tokens', 'Manage authentication tokens'), ('impersonate_role', 'Impersonate role'), ('set_fake_time', 'Set fake time'), ('set_pretend_facility', 'Pretend to be in facility'), ('edit_course_permissions', 'Edit course permissions'), ('view_hidden_course_page', 'View hidden course page'), ('view_calendar', 'View calendar'), ('send_instant_message', 'Send instant message'), ('access_files_for', 'Access files for'), ('included_in_grade_statistics', 'Included in grade statistics'), ('skip_during_manual_grading', 'Skip during manual grading'), ('edit_exam', 'Edit exam'), ('issue_exam_ticket', 'Issue exam ticket'), ('batch_issue_exam_ticket', 'Batch issue exam ticket'), ('view_participant_masked_profile', "View participants' masked profile only"), ('view_flow_sessions_from_role', 'View flow sessions from role'), ('view_gradebook', 'View gradebook'), ('edit_grading_opportunity', 'Edit grading opportunity'), ('assign_grade', 'Assign grade'), ('view_grader_stats', 'View grader stats'), ('batch_import_grade', 'Batch-import grades'), ('batch_export_grade', 'Batch-export grades'), ('batch_download_submission', 'Batch-download submissions'), ('impose_flow_session_deadline', 'Impose flow session deadline'), ('batch_impose_flow_session_deadline', 'Batch-impose flow session deadline'), ('end_flow_session', 'End flow session'), ('batch_end_flow_session', 'Batch-end flow sessions'), ('regrade_flow_session', 'Regrade flow session'), ('batch_regrade_flow_session', 'Batch-regrade flow sessions'), ('recalculate_flow_session_grade', 'Recalculate flow session grade'), ('batch_recalculate_flow_session_grade', 'Batch-recalculate flow sesssion grades'), ('reopen_flow_session', 'Reopen flow session'), ('grant_exception', 'Grant exception'), ('view_analytics', 'View analytics'), ('preview_content', 'Preview content'), ('update_content', 'Update content'), ('use_git_endpoint', 'Use direct git endpoint'), ('use_markup_sandbox', 'Use markup sandbox'), ('use_page_sandbox', 'Use page sandbox'), ('test_flow', 'Test flow'), ('edit_events', 'Edit events'), ('query_participation', 'Query participation'), ('edit_participation', 'Edit participation'), ('preapprove_participation', 'Preapprove participation'), ('manage_instant_flow_requests', 'Manage instant flow requests')], db_index=True, max_length=200, verbose_name='Permission'),
),
migrations.AlterField(
model_name='participationrole',
name='identifier',
field=models.CharField(help_text="A symbolic name for this role, used in course code. Should be a valid identifier (as defined by Python). The name 'unenrolled' is special and refers to anyone not enrolled in the course.", max_length=100, verbose_name='Role identifier'),
),
migrations.AlterField(
model_name='participationrolepermission',
name='permission',
field=models.CharField(choices=[('edit_course', 'Edit course'), ('use_admin_interface', 'Use admin interface'), ('manage_authentication_tokens', 'Manage authentication tokens'), ('impersonate_role', 'Impersonate role'), ('set_fake_time', 'Set fake time'), ('set_pretend_facility', 'Pretend to be in facility'), ('edit_course_permissions', 'Edit course permissions'), ('view_hidden_course_page', 'View hidden course page'), ('view_calendar', 'View calendar'), ('send_instant_message', 'Send instant message'), ('access_files_for', 'Access files for'), ('included_in_grade_statistics', 'Included in grade statistics'), ('skip_during_manual_grading', 'Skip during manual grading'), ('edit_exam', 'Edit exam'), ('issue_exam_ticket', 'Issue exam ticket'), ('batch_issue_exam_ticket', 'Batch issue exam ticket'), ('view_participant_masked_profile', "View participants' masked profile only"), ('view_flow_sessions_from_role', 'View flow sessions from role'), ('view_gradebook', 'View gradebook'), ('edit_grading_opportunity', 'Edit grading opportunity'), ('assign_grade', 'Assign grade'), ('view_grader_stats', 'View grader stats'), ('batch_import_grade', 'Batch-import grades'), ('batch_export_grade', 'Batch-export grades'), ('batch_download_submission', 'Batch-download submissions'), ('impose_flow_session_deadline', 'Impose flow session deadline'), ('batch_impose_flow_session_deadline', 'Batch-impose flow session deadline'), ('end_flow_session', 'End flow session'), ('batch_end_flow_session', 'Batch-end flow sessions'), ('regrade_flow_session', 'Regrade flow session'), ('batch_regrade_flow_session', 'Batch-regrade flow sessions'), ('recalculate_flow_session_grade', 'Recalculate flow session grade'), ('batch_recalculate_flow_session_grade', 'Batch-recalculate flow sesssion grades'), ('reopen_flow_session', 'Reopen flow session'), ('grant_exception', 'Grant exception'), ('view_analytics', 'View analytics'), ('preview_content', 'Preview content'), ('update_content', 'Update content'), ('use_git_endpoint', 'Use direct git endpoint'), ('use_markup_sandbox', 'Use markup sandbox'), ('use_page_sandbox', 'Use page sandbox'), ('test_flow', 'Test flow'), ('edit_events', 'Edit events'), ('query_participation', 'Query participation'), ('edit_participation', 'Edit participation'), ('preapprove_participation', 'Preapprove participation'), ('manage_instant_flow_requests', 'Manage instant flow requests')], db_index=True, max_length=200, verbose_name='Permission'),
),
migrations.AlterField(
model_name='participationtag',
name='name',
field=models.CharField(help_text='Should be a valid identifier (as defined by Python).', max_length=100, verbose_name='Name of participation tag'),
),
]
11 changes: 10 additions & 1 deletion local_settings_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,16 @@
# "PORT": '5432',
# }
# }

# DATABASES = {
# "default": {
# "ENGINE": "django.db.backends.postgresql",
# "NAME": "relate",
# "USER": "sahilkamboj",
# "PASSWORD": 'lovebread3',
# "HOST": '127.0.0.1',
# "PORT": '5432',
# }
# }
Copy link
Owner

Choose a reason for hiding this comment

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

?

# Recommended, because dulwich is kind of slow in retrieving stuff.
#
# Also, progress bars for long-running operations will only work
Expand Down
4 changes: 2 additions & 2 deletions tests/test_flow/test_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -823,7 +823,7 @@ def test_points_percent_full(self):
)

# for visualization purposes
self.assertTrue(99 < g_info.points_percent() < 100)
self.assertTrue(99 < g_info.points_percent() <= 100)

def test_points_percent_max_points_none(self):
g_info = flow.GradeInfo(
Expand Down Expand Up @@ -928,7 +928,7 @@ def test_unreachable_points_percent_full(self):

# for visualization purposes
self.assertTrue(
99 < g_info.unreachable_points_percent() < 100)
99 < g_info.unreachable_points_percent() <= 100)


@pytest.mark.slow
Expand Down