Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
b25c5a6
WIP: change Course model to handle fields
pstaabp May 16, 2022
e0de746
WIP: updating courses and generic problem sets on improvements.
pstaabp May 19, 2022
b7ff6fb
WIP: more work on switching models.
pstaabp May 20, 2022
fc7dd5d
WIP: work on getting the UI simpler with newer models.
pstaabp May 20, 2022
bc83691
WIP: fixed loading of users by file.
pstaabp May 20, 2022
bd8538b
WIP: cleanup
pstaabp May 21, 2022
2b60eaf
Merge branch 'db-send-json-boolean' into model-improvements
pstaabp May 21, 2022
887f84f
FIX: set_visible for problem_sets was not a JSON boolean.
pstaabp May 21, 2022
6ab7ec4
WIP: Move the enable_reduced_scoring from set_params to set_dates in …
pstaabp May 23, 2022
9280563
WIP: contined work on the models and tests.
pstaabp May 23, 2022
9265b45
Merge branch 'db-send-json-boolean' into model-improvements
pstaabp May 28, 2022
e138f0a
FIX: for dates in csv files, remove time-zone and also hack to get te…
pstaabp Jun 1, 2022
ed81b0e
FIX: store tests
pstaabp Jun 2, 2022
133098c
FIX: refactor the way csv files are loaded in the perl test files.
pstaabp Jun 2, 2022
d3fb3f6
FIX: linting and perlcritic cleanup.
pstaabp Jun 2, 2022
cbfab52
FIX: updated UI to reflect that enable_reduced_scoring is moved from …
pstaabp Jun 8, 2022
0692d06
Merge branch 'main' into model-improvements
pstaabp Jun 9, 2022
5c924d4
FIX: errors with tests after merge.
pstaabp Jun 9, 2022
9af6bc2
Merge branch 'db-send-json-boolean' into model-improvements
pstaabp Jun 13, 2022
75080a6
TEST: adding tests to ensure that only valid models are added to the …
pstaabp Jun 15, 2022
55a31fb
FIX: linting and typos
pstaabp Jun 15, 2022
d879ccd
FIX: tests now return the database to it's original state.
pstaabp Jun 16, 2022
1edc7ab
FIX: linting
pstaabp Jun 17, 2022
e532ccf
Merge branch 'db-send-json-boolean' into model-improvements
pstaabp Jun 17, 2022
e328665
FIX: testing errors
pstaabp Jun 17, 2022
f6a0977
FIX: cleanup and using true/false in tests.
pstaabp Jun 17, 2022
753e0be
Merge branch 'db-send-json-boolean' into model-improvements
pstaabp Jun 29, 2022
c02696c
WIP: check that enable_reduced_scoring is a boolean.
pstaabp Jun 29, 2022
5165dbe
FIX: perltidy/perlcritic errors
pstaabp Jun 29, 2022
5196256
Merge branch 'db-send-json-boolean' into model-improvements
pstaabp Jun 29, 2022
04e8fe5
Merge branch 'db-send-json-boolean' into model-improvements
pstaabp Jul 2, 2022
f16d56d
FIX: issues after merge with main.
pstaabp Jul 2, 2022
53839a5
Merge branch 'db-send-json-boolean' into model-improvements
pstaabp Jul 2, 2022
e4a5dc9
FIX: cleanup after merge
pstaabp Jul 5, 2022
282c1ea
FIX: unit tests for review sets.
pstaabp Jul 6, 2022
597aa7f
Merge branch 'db-send-json-boolean' into model-improvements
pstaabp Jul 8, 2022
7f6baed
FIX: linting after merge.
pstaabp Jul 8, 2022
f688760
FIX: perltidy
pstaabp Jul 11, 2022
dbe2f02
FIX: add users manually wasn't working. There was related model/stor…
pstaabp Jul 15, 2022
9750fa0
FIX: linting error.
pstaabp Jul 15, 2022
89c5842
FIX: make a server call only if the username is valid
pstaabp Jul 15, 2022
4c3cf09
WIP: initial checkin of some changes to handling settings.
pstaabp Aug 2, 2022
a32d5c3
WIP: work on course settings
pstaabp Aug 2, 2022
bb3998c
Merge branch 'main' into course-settings-work
pstaabp Aug 2, 2022
75f17ad
FIX: errors after merge
pstaabp Aug 2, 2022
de68081
FIX: perl linting error
pstaabp Aug 2, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
285 changes: 143 additions & 142 deletions conf/course_defaults.yml → conf/course_settings.yml

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions lib/DB/Exception.pm
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ use Exception::Class (
fields => ['message'],
description => 'There is an invalid field type'
},
'DB::Expection::SettingNotFound' => {
fields => ['name'],
description => 'A global setting is not found'
},
'DB::Exception::UndefinedParameter' => {
fields => ['field_names'],
description => 'There is an undefined parameter'
Expand Down
4 changes: 2 additions & 2 deletions lib/DB/Schema/Result/Course.pm
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ __PACKAGE__->has_many(problem_sets => 'DB::Schema::Result::ProblemSet', 'course_
# set up the one-to-many relationship to problem_pools
__PACKAGE__->has_many(problem_pools => 'DB::Schema::Result::ProblemPool', 'course_id');

# set up the one-to-one relationship to course settings;
__PACKAGE__->has_one(course_settings => 'DB::Schema::Result::CourseSettings', 'course_id');
# set up the one-to-many relationship to course settings;
__PACKAGE__->has_many(course_settings => 'DB::Schema::Result::CourseSetting', 'course_id');

1;
72 changes: 72 additions & 0 deletions lib/DB/Schema/Result/CourseSetting.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
package DB::Schema::Result::CourseSetting;
use base qw/DBIx::Class::Core/;
use strict;
use warnings;

=head1 DESCRIPTION

This is the database schema for a CourseSetting.

=head2 fields

=over

=item *

C<course_setting_id>: database id (autoincrement integer)

=item *

C<course_id>: database id of the course for the setting (foreign key)

=item *

C<setting_id>: database id that the given setting is related to (foreign key)

=item *

C<value>: the value of the setting as a JSON so different types of data can be stored.

=back

=cut

__PACKAGE__->table('course_setting');

__PACKAGE__->load_components('InflateColumn::Serializer', 'Core');

__PACKAGE__->add_columns(
course_setting_id => {
data_type => 'integer',
size => 16,
is_nullable => 0,
is_auto_increment => 1,
},
course_id => {
data_type => 'integer',
size => 16,
is_nullable => 0,
},
setting_id => {
data_type => 'integer',
size => 16,
is_nullable => 0,
},
value => {
data_type => 'text',
is_nullable => 0,
default_value => '\'\'',
serializer_class => 'JSON',
serializer_options => { utf8 => 1 }
},
);

__PACKAGE__->set_primary_key('course_setting_id');

__PACKAGE__->add_unique_constraint([qw/course_id setting_id/]);

__PACKAGE__->belongs_to(course => 'DB::Schema::Result::Course', 'course_id');

__PACKAGE__->belongs_to(global_setting => 'DB::Schema::Result::GlobalSetting', 'setting_id');

1;
128 changes: 0 additions & 128 deletions lib/DB/Schema/Result/CourseSettings.pm

This file was deleted.

117 changes: 117 additions & 0 deletions lib/DB/Schema/Result/GlobalSetting.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
package DB::Schema::Result::GlobalSetting;
use base qw/DBIx::Class::Core/;
use strict;
use warnings;

=head1 DESCRIPTION

This is the database schema for the Global Course Settings.

=head2 fields

=over

=item *

C<setting_id>: database id (autoincrement integer)

=item *

C<setting_name>: the name of the setting

=item *

C<default_value>: a JSON object of the default value for the setting

=item *

C<description>: a short description of the setting

=item *

C<doc>: more extensive help documentation.

=item *

C<type>: a string representation of the type of setting (boolean, text, list, ...)

=item *

C<options>: a JSON object that stores options if the setting is an list or multilist

=item *

C<category>: the category the setting falls into

=item *

C<subcategory>: the subcategory of the setting (may be null)

=back

=cut

__PACKAGE__->table('global_setting');

__PACKAGE__->load_components('InflateColumn::Serializer', 'Core');

__PACKAGE__->add_columns(
setting_id => {
data_type => 'integer',
size => 16,
is_nullable => 0,
is_auto_increment => 1,
},
setting_name => {
data_type => 'varchar',
size => 256,
is_nullable => 0,
},
default_value => {
data_type => 'text',
is_nullable => 0,
default_value => '\'\'',
serializer_class => 'JSON',
serializer_options => { utf8 => 1 }
},
description => {
data_type => 'text',
is_nullable => 0,
default_value => '',
},
doc => {
data_type => 'text',
is_nullable => 1,
},
type => {
data_type => 'varchar',
size => 16,
is_nullable => 0,
default_value => '',
},
options => {
data_type => 'text',
is_nullable => 1,
serializer_class => 'JSON',
serializer_options => { utf8 => 1 }
},
category => {
data_type => 'varchar',
size => 64,
is_nullable => 0,
default_value => ''
},
subcategory => {
data_type => 'varchar',
size => 64,
is_nullable => 1
}
);

__PACKAGE__->set_primary_key('setting_id');

__PACKAGE__->has_many(course_settings => 'DB::Schema::Result::CourseSetting', 'setting_id');

# __PACKAGE__->belongs_to(course => 'DB::Schema::Result::Course', 'course_id');

1;
Loading