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

in Course Config, don't claim database settings are defaults #2557

Merged
merged 1 commit into from
Sep 3, 2024

Conversation

Alex-Jordan
Copy link
Contributor

IIRC when I added the course title as something you can change in the config page (and "setting" values in general), the "Default" column was left blank for that row. Somewhere along the line things changed so now you see the current course title in the "Default" column. But that doesn't make sense. It's not like you could clear the entry in the "Current" column and it would revert to what it says in the "Default" column.

So this change makes it so that entry is once again empty.

Before:

Screenshot 2024-09-02 at 11 22 39 PM

After:

Screenshot 2024-09-02 at 11 22 07 PM

Copy link
Contributor

@somiaj somiaj left a comment

Choose a reason for hiding this comment

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

This looks like a minor fix that could be a hot fix as well.

Copy link
Sponsor Member

@drgrice1 drgrice1 left a comment

Choose a reason for hiding this comment

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

I don't like this approach to fixing the issue. Each config object should be responsible for returning the correct thing for these methods using the override in the config object module. This approach makes the base module handle it. If instead the get_value method of lib/WeBWorK/ConfigObject/setting.pm were changed to

sub get_value ($self, $ce) {
	# If the course name of the controller's course environment is the same as the passed course environment, then
	# return the value from the database.  Otherwise this is the default site wide setting. So return the empty string
	# (there is no default).
	return $self->{c}->ce->{courseName} eq $ce->{courseName}
		? ($self->{c}->db->getSettingValue($self->{var}) // '')
		: '';
}

then the module is handling it by itself. This works on the principle that the course environment of the controller is always the current course's course environment, while the course environment that is passed is the generic course environment with the courseName '___' in the case that the site default value is requested. Any other time the get_value method is called the courseName's will match.

@Alex-Jordan
Copy link
Contributor Author

I changed this to how @drgrice1 posted. The change is now 100% Glenn's code so I changed the commit author :)

@Alex-Jordan
Copy link
Contributor Author

I can live with this not having a hotfix variant. But if anyone wants that, shout out.

@drgrice1 drgrice1 merged commit 1ef614d into openwebwork:develop Sep 3, 2024
2 checks passed
drgrice1 added a commit that referenced this pull request Sep 3, 2024
in Course Config, don't claim database settings are defaults (hotfix for #2557)
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.

3 participants