Skip to content

Commit 9c1d4cc

Browse files
committed
FIX: fixes after rebasing.
FIX: fixes after rebasing.
1 parent c8e7cef commit 9c1d4cc

File tree

7 files changed

+14
-14
lines changed

7 files changed

+14
-14
lines changed

lib/DB/Schema/ResultSet/UserSet.pm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,10 @@ sub getAllUserSetsForCourse ($self, %args) {
105105
my $course = $self->rs('Course')->getCourse(info => $args{info}, as_result_set => 1);
106106
my @user_sets = $self->search(
107107
{
108-
'courses.course_id' => $course->course_id
108+
'course.course_id' => $course->course_id
109109
},
110110
{
111-
join => [ { 'problem_set' => 'courses' }, { 'course_users' => 'users' } ]
111+
join => [ { 'problem_set' => 'course' }, { 'course_user' => 'user' } ]
112112
}
113113
);
114114

src/layouts/MenuBar.vue

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,6 @@ import { endSession } from 'src/common/api-requests/session';
7373
import { useSessionStore } from 'src/stores/session';
7474
import { useSettingsStore } from 'src/stores/settings';
7575
76-
import type { CourseSettingInfo } from 'src/common/models/settings';
77-
7876
defineEmits(['toggle-menu', 'toggle-sidebar']);
7977
const session = useSessionStore();
8078
const settings = useSettingsStore();

src/pages/instructor/Instructor.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ if (course_id !== session.course.course_id) {
3939
await users.fetchGlobalCourseUsers(course_id);
4040
await users.fetchCourseUsers(course_id);
4141
await problem_sets.fetchProblemSets(course_id);
42-
await settings.fetchDefaultSettings(course_id)
42+
await settings.fetchGlobalSettings()
4343
.then(() => settings.fetchCourseSettings(course_id))
4444
.then(() => void setI18nLanguage(settings.getCourseSetting('language').value as string))
4545
.catch((err) => logger.error(`${JSON.stringify(err)}`));

src/stores/settings.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,13 @@ export const useSettingsStore = defineStore('settings', {
3131
* This returns the course setting by name.
3232
*/
3333
getCourseSetting: (state) => (setting_name: string): CourseSetting => {
34+
const session_store = useSessionStore();
3435
const global_setting = state.global_settings.find(setting => setting.setting_name === setting_name);
3536
if (global_setting) {
3637
const db_course_setting = state.db_course_settings
3738
.find(setting => setting.setting_id === global_setting?.setting_id);
3839
return new CourseSetting(Object.assign(
39-
db_course_setting?.toObject() ?? {},
40+
db_course_setting?.toObject() ?? { course_id: session_store.course.course_id },
4041
global_setting?.toObject()));
4142
} else {
4243
throw `The setting with name: '${setting_name}' does not exist.`;

tests/stores/set_problems.spec.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ import { Dictionary, generic } from 'src/common/models';
2727

2828
import { loadCSV, cleanIDs } from '../utils';
2929
import { checkPassword } from 'src/common/api-requests/session';
30-
import { logger } from 'src/boot/logger';
3130

3231
const app = createApp({});
3332

tests/stores/settings.spec.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import { CourseSetting, DBCourseSetting, GlobalSetting, ParseableDBCourseSetting
2424

2525
import { cleanIDs, loadCSV } from '../utils';
2626
import { humanReadableTimeDuration } from 'src/common/models/parsers';
27+
import { SessionInfo } from 'src/common/models/session';
2728

2829
describe('Test the settings store', () => {
2930

@@ -49,8 +50,14 @@ describe('Test the settings store', () => {
4950
.map(setting => ({
5051
setting_name: setting.setting_name as string, value: setting.setting_value as SettingValueType
5152
}));
52-
// Login to the course as the admin in order to be authenticated for the rest of the test.
53-
await api.post('login', { username: 'admin', password: 'admin' });
53+
// Login to the course as an instructor of Arithmetic. (course_id: 4)
54+
const response = await api.post('login', { username: 'lisa', password: 'lisa' });
55+
56+
// set the session course to the Arithmetic course (course_id: 4)
57+
const session_store = useSessionStore();
58+
session_store.updateSessionInfo(response.data as SessionInfo);
59+
await session_store.fetchUserCourses();
60+
session_store.setCourse(4);
5461

5562
const settings_store = useSettingsStore();
5663
await settings_store.fetchGlobalSettings();
@@ -92,10 +99,6 @@ describe('Test the settings store', () => {
9299
.filter(setting => arith_setting_ids.includes(setting.setting_id))
93100
.map(setting => ({ setting_name: setting.setting_name, value: setting.value }));
94101
expect(arith_settings_from_db).toStrictEqual(arith_settings);
95-
96-
// set the session course to this course
97-
const session_store = useSessionStore();
98-
session_store.setCourse({ course_id: 4, course_name: 'Arithmetic' });
99102
});
100103

101104
test('Get a single course setting based on name', () => {

tests/stores/user_sets.spec.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import { createApp } from 'vue';
1212
import { createPinia, setActivePinia } from 'pinia';
1313
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate';
14-
import { api } from 'boot/axios';
1514

1615
import { useCourseStore } from 'src/stores/courses';
1716
import { useProblemSetStore } from 'src/stores/problem_sets';

0 commit comments

Comments
 (0)