diff --git a/backend/api/fixtures/8_jig.sql b/backend/api/fixtures/8_jig.sql index 19607c3be..30090d3ae 100644 --- a/backend/api/fixtures/8_jig.sql +++ b/backend/api/fixtures/8_jig.sql @@ -1,24 +1,24 @@ insert into jig_data (id, display_name, created_at, updated_at, language, last_synced_at, description, theme, - audio_background, audio_feedback_negative, audio_feedback_positive, direction, privacy_level, display_score, - drag_assist, track_assessments, draft_or_live, translated_description) + audio_background, audio_feedback_negative, audio_feedback_positive, direction, privacy_level, scoring, + drag_assist, draft_or_live, translated_description) values ('d4cad43c-1dd5-11ec-8426-83d4a42e3ac9', 'name', '2021-03-04 00:46:26.134651+00', -- live '2021-03-04 00:46:26.134651+00', 'en', '2021-03-04 00:46:26.134651+00', 'test description', 0, null, - array [0, 1], array [0, 1, 2], 0, 0, true, true, true, 1, '{}'::jsonb), + array [0, 1], array [0, 1, 2], 0, 0, true, true, 1, '{}'::jsonb), ('d4cad4c8-1dd5-11ec-8426-a37eda7ce03f', 'name', '2021-03-04 00:46:26.134651+00', -- draft '2021-03-04 00:46:26.134651+00', 'en', '2021-03-04 00:46:26.134651+00', 'test description', 0, null, - array [0, 1], array [0, 1, 2], 0, 1, true, true, true, 0, '{}'::jsonb), + array [0, 1], array [0, 1, 2], 0, 1, true, true, 0, '{}'::jsonb), ('d4cad52c-1dd5-11ec-8426-f7f3e8ceccb2', 'name', '2021-03-04 00:46:26.134651+00', -- live '2021-03-04 00:46:26.134651+00', 'en', '2021-03-04 00:46:26.134651+00', 'test description', 0, null, - array [0, 1], array [0, 1, 2], 0, 0, true, true, true, 1, '{}'::jsonb), + array [0, 1], array [0, 1, 2], 0, 0, true, true, 1, '{}'::jsonb), ('38ef2e9c-9d7f-4a96-aed4-164f7f42bf0c', 'name', '2021-03-04 00:46:26.134651+00', -- live '2021-03-04 00:46:26.134651+00', 'en', '2021-03-04 00:46:26.134651+00', 'test description', 0, null, - array [0, 1], array [0, 1, 2], 0, 0, true, true, true, 1, '{}'::jsonb), + array [0, 1], array [0, 1, 2], 0, 0, true, true, 1, '{}'::jsonb), ('456f571e-ea27-460e-b065-2bbd77d350ae', 'name', '2021-03-04 00:46:26.134651+00', -- draft '2021-03-04 00:46:26.134651+00', 'en', '2021-03-04 00:46:26.134651+00', 'test description', 0, null, - array [0, 1], array [0, 1, 2], 0, 1, true, true, true, 0, '{}'::jsonb), + array [0, 1], array [0, 1, 2], 0, 1, true, true, 0, '{}'::jsonb), ('d4cad586-1dd5-11ec-8426-fbcd3fd01e2a', 'draft name', '2021-03-06 00:46:26.134651+00', -- draft '2021-03-06 00:46:26.134651+00', 'he', '2021-03-07 00:46:26.134651+00', 'draft test description', 1, 0, - array []::smallint[], array []::smallint[], 1, 1, false, false, false, 0, '{}'::jsonb); + array []::smallint[], array []::smallint[], 1, 1, false, false, 0, '{}'::jsonb); insert into jig (id, creator_id, author_id, live_id, draft_id, published_at) @@ -59,9 +59,9 @@ values ('d4cad43c-1dd5-11ec-8426-83d4a42e3ac9', '286b828c-1dd9-11ec-8426-571b03b 'link test', 'a91aca34-519e-11ec-ab46-175eaaf1ff23', '{ "link": "url://url.url.url/urls/s" }'), -- draft ('d4cad4c8-1dd5-11ec-8426-a37eda7ce03f', '286b8390-1dd9-11ec-8426-fbeb80c504d9', 'link test', 'a91aca34-519e-11ec-ab46-175eaaf1ff23', '{ "link": "url://url.url.url/url/s" }'); -insert into jig_code (code, jig_id, created_at, creator_id, expires_at, direction, display_score, track_assessments, drag_assist) -values (1234, '0cc084bc-7c83-11eb-9f77-e3218dffb008', now(), '1f241e1b-b537-493f-a230-075cb16315be', now() - interval '5 minutes', 0, true, true, true), - (1235, '0cc084bc-7c83-11eb-9f77-e3218dffb008', now(), '1f241e1b-b537-493f-a230-075cb16315be', now() + interval '5 minutes', 0, true, true, true);; +insert into jig_code (code, jig_id, created_at, creator_id, expires_at, direction, scoring, drag_assist) +values (1234, '0cc084bc-7c83-11eb-9f77-e3218dffb008', now(), '1f241e1b-b537-493f-a230-075cb16315be', now() - interval '5 minutes', 0, true, true), + (1235, '0cc084bc-7c83-11eb-9f77-e3218dffb008', now(), '1f241e1b-b537-493f-a230-075cb16315be', now() + interval '5 minutes', 0, true, true);; insert into jig_play_count (jig_id) select id diff --git a/backend/api/migrations/20240221145034_combine-tracking-assessment.sql b/backend/api/migrations/20240221145034_combine-tracking-assessment.sql new file mode 100644 index 000000000..0c9bdaee5 --- /dev/null +++ b/backend/api/migrations/20240221145034_combine-tracking-assessment.sql @@ -0,0 +1,4 @@ +alter table jig_code drop column track_assessments; +alter table jig_code rename column display_score to scoring; +alter table jig_data drop column track_assessments; +alter table jig_data rename column display_score to scoring; diff --git a/backend/api/src/db/jig.rs b/backend/api/src/db/jig.rs index 00f15114f..c8d46205e 100644 --- a/backend/api/src/db/jig.rs +++ b/backend/api/src/db/jig.rs @@ -112,16 +112,15 @@ pub async fn create_jig_data( // language=SQL r#" insert into jig_data - (display_name, language, description, direction, display_score, track_assessments, drag_assist, draft_or_live) -values ($1, $2, $3, $4, $5, $6, $7, $8) + (display_name, language, description, direction, scoring, drag_assist, draft_or_live) +values ($1, $2, $3, $4, $5, $6, $7) returning id "#, display_name, language, description, default_player_settings.direction as i16, - default_player_settings.display_score, - default_player_settings.track_assessments, + default_player_settings.scoring, default_player_settings.drag_assist, draft_or_live as i16, ) @@ -206,8 +205,7 @@ select cte.jig_id as "jig_id: JigId", description, translated_description as "translated_description!: Json>", direction as "direction: TextDirection", - display_score, - track_assessments, + scoring, drag_assist, theme as "theme: ThemeId", audio_background as "audio_background: AudioBackground", @@ -283,8 +281,7 @@ from jig_data description: row.description, default_player_settings: JigPlayerSettings { direction: row.direction, - display_score: row.display_score, - track_assessments: row.track_assessments, + scoring: row.scoring, drag_assist: row.drag_assist, }, theme: row.theme, @@ -397,8 +394,7 @@ select id, description as "description!", translated_description as "translated_description!: Json>", direction as "direction!: TextDirection", - display_score as "display_score!", - track_assessments as "track_assessments!", + scoring as "scoring!", drag_assist as "drag_assist!", theme as "theme!: ThemeId", audio_background as "audio_background!: Option", @@ -476,8 +472,7 @@ order by ord asc description: jig_data_row.description, default_player_settings: JigPlayerSettings { direction: jig_data_row.direction, - display_score: jig_data_row.display_score, - track_assessments: jig_data_row.track_assessments, + scoring: jig_data_row.scoring, drag_assist: jig_data_row.drag_assist, }, theme: jig_data_row.theme, @@ -603,8 +598,7 @@ select jig.id as "jig_id: JigId", description as "description!", translated_description as "translated_description!: Json>", direction as "direction!: TextDirection", - display_score as "display_score!", - track_assessments as "track_assessments!", + scoring as "scoring!", drag_assist as "drag_assist!", theme as "theme!: ThemeId", audio_background as "audio_background!: Option", @@ -703,8 +697,7 @@ limit $8 description: jig_data_row.description, default_player_settings: JigPlayerSettings { direction: jig_data_row.direction, - display_score: jig_data_row.display_score, - track_assessments: jig_data_row.track_assessments, + scoring: jig_data_row.scoring, drag_assist: jig_data_row.drag_assist, }, theme: jig_data_row.theme, @@ -847,20 +840,17 @@ where id = $1 and ($2 <> audio_feedback_positive or $3 <> audio_feedback_negativ r#" update jig_data set direction = $2, - display_score = $3, - track_assessments = $4, - drag_assist = $5, + scoring = $3, + drag_assist = $4, updated_at = now() where id = $1 and (($2 is distinct from direction) or - ($3 is distinct from display_score) or - ($4 is distinct from track_assessments) or - ($5 is distinct from drag_assist)) + ($3 is distinct from scoring) or + ($4 is distinct from drag_assist)) "#, draft_id, settings.direction as i16, - settings.display_score, - settings.track_assessments, + settings.scoring, settings.drag_assist, ) .execute(&mut txn) @@ -1213,7 +1203,7 @@ async fn clone_data( r#" insert into jig_data (display_name, created_at, updated_at, language, last_synced_at, description, theme, audio_background, - audio_feedback_negative, audio_feedback_positive, direction, display_score, drag_assist, track_assessments, privacy_level, other_keywords, translated_keywords, translated_description) + audio_feedback_negative, audio_feedback_positive, direction, scoring, drag_assist, privacy_level, other_keywords, translated_keywords, translated_description) select display_name, created_at, updated_at, @@ -1225,9 +1215,8 @@ select display_name, audio_feedback_negative, audio_feedback_positive, direction, - display_score, + scoring, drag_assist, - track_assessments, privacy_level, other_keywords, translated_keywords, diff --git a/backend/api/src/db/jig/codes.rs b/backend/api/src/db/jig/codes.rs index 014faa471..7bd027830 100644 --- a/backend/api/src/db/jig/codes.rs +++ b/backend/api/src/db/jig/codes.rs @@ -35,8 +35,8 @@ pub async fn create( match sqlx::query!( //language=SQL r#" -insert into jig_code (jig_id, creator_id, name, code, direction, display_score, track_assessments, drag_assist, expires_at) -values ($1, $2, $3, $4, $5, $6, $7, $8, $9) +insert into jig_code (jig_id, creator_id, name, code, direction, scoring, drag_assist, expires_at) +values ($1, $2, $3, $4, $5, $6, $7, $8) returning created_at as "created_at: DateTime" "#, opts.jig_id.0, @@ -44,8 +44,7 @@ returning created_at as "created_at: DateTime" opts.name, code, opts.settings.direction as i16, - opts.settings.display_score, - opts.settings.track_assessments, + opts.settings.scoring, opts.settings.drag_assist, expires_at, ) @@ -61,13 +60,13 @@ returning created_at as "created_at: DateTime" created_at: res.created_at, expires_at, }) - }, + } Err(err) => match err { sqlx::Error::Database(db_err) => { session_create_error_or_continue(db_err)?; // did not return error on previous line, retry with new code code = generate_random_code(&mut generator); - }, + } err => return Err(anyhow::anyhow!("sqlx error: {:?}", err).into()), }, } @@ -109,8 +108,7 @@ pub async fn list_user_codes( select code as "code!: i32", jig_id as "jig_id: JigId", direction as "direction: TextDirection", - display_score, - track_assessments, + scoring, drag_assist, name as "name?", created_at as "created_at: DateTime", @@ -130,8 +128,7 @@ where creator_id = $1 AND (jig_id = $2 or $2 is null) name: it.name, settings: JigPlayerSettings { direction: it.direction, - display_score: it.display_score, - track_assessments: it.track_assessments, + scoring: it.scoring, drag_assist: it.drag_assist, }, created_at: it.created_at, @@ -209,8 +206,7 @@ pub async fn start_session( r#" select jig_id as "jig_id: JigId", direction as "direction: TextDirection", - display_score, - track_assessments, + scoring, drag_assist from jig_code where code=$1 @@ -242,8 +238,7 @@ pub async fn start_session( session_info.jig_id, JigPlayerSettings { direction: session_info.direction, - display_score: session_info.display_score, - track_assessments: session_info.track_assessments, + scoring: session_info.scoring, drag_assist: session_info.drag_assist, }, instance_id, diff --git a/backend/api/tests/integration/jig/codes.rs b/backend/api/tests/integration/jig/codes.rs index a21744231..c45efb32f 100644 --- a/backend/api/tests/integration/jig/codes.rs +++ b/backend/api/tests/integration/jig/codes.rs @@ -24,8 +24,7 @@ async fn create_and_list(port: u16) -> anyhow::Result<()> { "jigId": "3a71522a-cd77-11eb-8dc1-af3e35f7c743", "settings": { "direction": "rtl", - "display_score": false, - "track_assessments": false, + "scoring": false, "drag_assist": false, } })) @@ -38,7 +37,7 @@ async fn create_and_list(port: u16) -> anyhow::Result<()> { let body: JigCodeResponse = resp.json().await?; - insta::assert_json_snapshot!(format!("{}-1",name), body, { ".**.index" => "[index]", ".**.expires_at" => "[timestamp]" }); + insta::assert_json_snapshot!(format!("{}-1",name), body, { ".**.index" => "[index]", ".**.created_at" => "[timestamp]", ".**.expires_at" => "[timestamp]" }); let _resp = client .post(&format!("http://0.0.0.0:{}/v1/jig/codes", port)) @@ -46,8 +45,7 @@ async fn create_and_list(port: u16) -> anyhow::Result<()> { "jigId": "3a71522a-cd77-11eb-8dc1-af3e35f7c743", "settings": { "direction": "rtl", - "display_score": true, - "track_assessments": false, + "scoring": true, "drag_assist": false, } })) @@ -67,7 +65,7 @@ async fn create_and_list(port: u16) -> anyhow::Result<()> { let body: JigCodeListResponse = resp.json().await?; - insta::assert_json_snapshot!(format!("{}-2",name), body, { ".**.index" => "[index]", ".**.expires_at" => "[timestamp]" }); + insta::assert_json_snapshot!(format!("{}-2",name), body, { ".**.index" => "[index]", ".**.created_at" => "[timestamp]", ".**.expires_at" => "[timestamp]" }); Ok(()) } @@ -84,7 +82,7 @@ async fn session_instance_play_count_flow(port: u16) -> anyhow::Result<()> { let resp = client .post(&format!("http://0.0.0.0:{}/v1/jig/codes/instance", port)) .json(&serde_json::json!({ - "code": 1234, + "code": 123456, })) .login() .send() diff --git a/backend/api/tests/integration/jig/snapshots/integration__jig__codes__create-1.snap b/backend/api/tests/integration/jig/snapshots/integration__jig__codes__create-1.snap index eac51e456..dd1770e70 100644 --- a/backend/api/tests/integration/jig/snapshots/integration__jig__codes__create-1.snap +++ b/backend/api/tests/integration/jig/snapshots/integration__jig__codes__create-1.snap @@ -8,9 +8,9 @@ expression: body "name": null, "settings": { "direction": "rtl", - "displayScore": false, - "trackAssessments": false, + "scoring": false, "dragAssist": false }, + "created_at": "[timestamp]", "expires_at": "[timestamp]" } diff --git a/backend/api/tests/integration/jig/snapshots/integration__jig__codes__create-2.snap b/backend/api/tests/integration/jig/snapshots/integration__jig__codes__create-2.snap index ef8eef087..d5dbf7876 100644 --- a/backend/api/tests/integration/jig/snapshots/integration__jig__codes__create-2.snap +++ b/backend/api/tests/integration/jig/snapshots/integration__jig__codes__create-2.snap @@ -10,10 +10,10 @@ expression: body "name": null, "settings": { "direction": "ltr", - "displayScore": true, - "trackAssessments": true, + "scoring": true, "dragAssist": true }, + "created_at": "[timestamp]", "expires_at": "[timestamp]" }, { @@ -22,10 +22,10 @@ expression: body "name": null, "settings": { "direction": "ltr", - "displayScore": true, - "trackAssessments": true, + "scoring": true, "dragAssist": true }, + "created_at": "[timestamp]", "expires_at": "[timestamp]" }, { @@ -34,10 +34,10 @@ expression: body "name": null, "settings": { "direction": "rtl", - "displayScore": false, - "trackAssessments": false, + "scoring": false, "dragAssist": false }, + "created_at": "[timestamp]", "expires_at": "[timestamp]" }, { @@ -46,10 +46,10 @@ expression: body "name": null, "settings": { "direction": "rtl", - "displayScore": false, - "trackAssessments": false, + "scoring": true, "dragAssist": false }, + "created_at": "[timestamp]", "expires_at": "[timestamp]" } ] diff --git a/backend/api/tests/integration/jig/snapshots/integration__jig__codes__session_instance_play_count_flow-1.snap b/backend/api/tests/integration/jig/snapshots/integration__jig__codes__session_instance_play_count_flow-1.snap index 6ad997a6d..187d806bc 100644 --- a/backend/api/tests/integration/jig/snapshots/integration__jig__codes__session_instance_play_count_flow-1.snap +++ b/backend/api/tests/integration/jig/snapshots/integration__jig__codes__session_instance_play_count_flow-1.snap @@ -6,8 +6,7 @@ expression: body "jigId": "0cc084bc-7c83-11eb-9f77-e3218dffb008", "settings": { "direction": "ltr", - "displayScore": true, - "trackAssessments": true, + "scoring": true, "dragAssist": true }, "token": "[instance_token]" diff --git a/backend/api/tests/integration/jig/snapshots/integration__jig__cover__update_no_modules_changes.snap b/backend/api/tests/integration/jig/snapshots/integration__jig__cover__update_no_modules_changes.snap index 140e22cb6..1b82074dc 100644 --- a/backend/api/tests/integration/jig/snapshots/integration__jig__cover__update_no_modules_changes.snap +++ b/backend/api/tests/integration/jig/snapshots/integration__jig__cover__update_no_modules_changes.snap @@ -57,8 +57,7 @@ expression: body "description": "test description", "defaultPlayerSettings": { "direction": "ltr", - "displayScore": true, - "trackAssessments": true, + "scoring": true, "dragAssist": true }, "theme": "Blank", diff --git a/backend/api/tests/integration/jig/snapshots/integration__jig__module__drag_up_down_modules-1.snap b/backend/api/tests/integration/jig/snapshots/integration__jig__module__drag_up_down_modules-1.snap index ff5757931..444e6eb94 100644 --- a/backend/api/tests/integration/jig/snapshots/integration__jig__module__drag_up_down_modules-1.snap +++ b/backend/api/tests/integration/jig/snapshots/integration__jig__module__drag_up_down_modules-1.snap @@ -57,8 +57,7 @@ expression: body "description": "test description", "defaultPlayerSettings": { "direction": "ltr", - "displayScore": true, - "trackAssessments": true, + "scoring": true, "dragAssist": true }, "theme": "Blank", diff --git a/backend/api/tests/integration/jig/snapshots/integration__jig__module__drag_up_down_modules-2.snap b/backend/api/tests/integration/jig/snapshots/integration__jig__module__drag_up_down_modules-2.snap index cab728419..6a73d2faa 100644 --- a/backend/api/tests/integration/jig/snapshots/integration__jig__module__drag_up_down_modules-2.snap +++ b/backend/api/tests/integration/jig/snapshots/integration__jig__module__drag_up_down_modules-2.snap @@ -57,8 +57,7 @@ expression: body "description": "test description", "defaultPlayerSettings": { "direction": "ltr", - "displayScore": true, - "trackAssessments": true, + "scoring": true, "dragAssist": true }, "theme": "Blank", diff --git a/backend/api/tests/integration/snapshots/integration__jig__browse_order_by-1.snap b/backend/api/tests/integration/snapshots/integration__jig__browse_order_by-1.snap index 9e323744f..83625b4fc 100644 --- a/backend/api/tests/integration/snapshots/integration__jig__browse_order_by-1.snap +++ b/backend/api/tests/integration/snapshots/integration__jig__browse_order_by-1.snap @@ -59,8 +59,7 @@ expression: body "description": "test description", "defaultPlayerSettings": { "direction": "ltr", - "displayScore": true, - "trackAssessments": true, + "scoring": true, "dragAssist": true }, "theme": "Blank", @@ -113,8 +112,7 @@ expression: body "description": "test description", "defaultPlayerSettings": { "direction": "ltr", - "displayScore": true, - "trackAssessments": true, + "scoring": true, "dragAssist": true }, "theme": "Blank", @@ -160,8 +158,7 @@ expression: body "description": "draft test description", "defaultPlayerSettings": { "direction": "rtl", - "displayScore": false, - "trackAssessments": false, + "scoring": false, "dragAssist": false }, "theme": "Jigzi", @@ -207,8 +204,7 @@ expression: body "description": "test description", "defaultPlayerSettings": { "direction": "ltr", - "displayScore": true, - "trackAssessments": true, + "scoring": true, "dragAssist": true }, "theme": "Blank", diff --git a/backend/api/tests/integration/snapshots/integration__jig__browse_order_by-2.snap b/backend/api/tests/integration/snapshots/integration__jig__browse_order_by-2.snap index 9e323744f..83625b4fc 100644 --- a/backend/api/tests/integration/snapshots/integration__jig__browse_order_by-2.snap +++ b/backend/api/tests/integration/snapshots/integration__jig__browse_order_by-2.snap @@ -59,8 +59,7 @@ expression: body "description": "test description", "defaultPlayerSettings": { "direction": "ltr", - "displayScore": true, - "trackAssessments": true, + "scoring": true, "dragAssist": true }, "theme": "Blank", @@ -113,8 +112,7 @@ expression: body "description": "test description", "defaultPlayerSettings": { "direction": "ltr", - "displayScore": true, - "trackAssessments": true, + "scoring": true, "dragAssist": true }, "theme": "Blank", @@ -160,8 +158,7 @@ expression: body "description": "draft test description", "defaultPlayerSettings": { "direction": "rtl", - "displayScore": false, - "trackAssessments": false, + "scoring": false, "dragAssist": false }, "theme": "Jigzi", @@ -207,8 +204,7 @@ expression: body "description": "test description", "defaultPlayerSettings": { "direction": "ltr", - "displayScore": true, - "trackAssessments": true, + "scoring": true, "dragAssist": true }, "theme": "Blank", diff --git a/backend/api/tests/integration/snapshots/integration__jig__browse_order_by-3.snap b/backend/api/tests/integration/snapshots/integration__jig__browse_order_by-3.snap index 9e323744f..83625b4fc 100644 --- a/backend/api/tests/integration/snapshots/integration__jig__browse_order_by-3.snap +++ b/backend/api/tests/integration/snapshots/integration__jig__browse_order_by-3.snap @@ -59,8 +59,7 @@ expression: body "description": "test description", "defaultPlayerSettings": { "direction": "ltr", - "displayScore": true, - "trackAssessments": true, + "scoring": true, "dragAssist": true }, "theme": "Blank", @@ -113,8 +112,7 @@ expression: body "description": "test description", "defaultPlayerSettings": { "direction": "ltr", - "displayScore": true, - "trackAssessments": true, + "scoring": true, "dragAssist": true }, "theme": "Blank", @@ -160,8 +158,7 @@ expression: body "description": "draft test description", "defaultPlayerSettings": { "direction": "rtl", - "displayScore": false, - "trackAssessments": false, + "scoring": false, "dragAssist": false }, "theme": "Jigzi", @@ -207,8 +204,7 @@ expression: body "description": "test description", "defaultPlayerSettings": { "direction": "ltr", - "displayScore": true, - "trackAssessments": true, + "scoring": true, "dragAssist": true }, "theme": "Blank", diff --git a/backend/api/tests/integration/snapshots/integration__jig__browse_simple.snap b/backend/api/tests/integration/snapshots/integration__jig__browse_simple.snap index 9e323744f..83625b4fc 100644 --- a/backend/api/tests/integration/snapshots/integration__jig__browse_simple.snap +++ b/backend/api/tests/integration/snapshots/integration__jig__browse_simple.snap @@ -59,8 +59,7 @@ expression: body "description": "test description", "defaultPlayerSettings": { "direction": "ltr", - "displayScore": true, - "trackAssessments": true, + "scoring": true, "dragAssist": true }, "theme": "Blank", @@ -113,8 +112,7 @@ expression: body "description": "test description", "defaultPlayerSettings": { "direction": "ltr", - "displayScore": true, - "trackAssessments": true, + "scoring": true, "dragAssist": true }, "theme": "Blank", @@ -160,8 +158,7 @@ expression: body "description": "draft test description", "defaultPlayerSettings": { "direction": "rtl", - "displayScore": false, - "trackAssessments": false, + "scoring": false, "dragAssist": false }, "theme": "Jigzi", @@ -207,8 +204,7 @@ expression: body "description": "test description", "defaultPlayerSettings": { "direction": "ltr", - "displayScore": true, - "trackAssessments": true, + "scoring": true, "dragAssist": true }, "theme": "Blank", diff --git a/backend/api/tests/integration/snapshots/integration__jig__clone-1.snap b/backend/api/tests/integration/snapshots/integration__jig__clone-1.snap index a88562055..e34109403 100644 --- a/backend/api/tests/integration/snapshots/integration__jig__clone-1.snap +++ b/backend/api/tests/integration/snapshots/integration__jig__clone-1.snap @@ -25,8 +25,7 @@ expression: body "description": "draft test description", "defaultPlayerSettings": { "direction": "rtl", - "displayScore": false, - "trackAssessments": false, + "scoring": false, "dragAssist": false }, "theme": "Jigzi", diff --git a/backend/api/tests/integration/snapshots/integration__jig__clone-2.snap b/backend/api/tests/integration/snapshots/integration__jig__clone-2.snap index c9f7725dd..0cd6460bf 100644 --- a/backend/api/tests/integration/snapshots/integration__jig__clone-2.snap +++ b/backend/api/tests/integration/snapshots/integration__jig__clone-2.snap @@ -25,8 +25,7 @@ expression: body "description": "test description", "defaultPlayerSettings": { "direction": "ltr", - "displayScore": true, - "trackAssessments": true, + "scoring": true, "dragAssist": true }, "theme": "Blank", diff --git a/backend/api/tests/integration/snapshots/integration__jig__create_default-2.snap b/backend/api/tests/integration/snapshots/integration__jig__create_default-2.snap index 7adff2adb..817a9b711 100644 --- a/backend/api/tests/integration/snapshots/integration__jig__create_default-2.snap +++ b/backend/api/tests/integration/snapshots/integration__jig__create_default-2.snap @@ -25,8 +25,7 @@ expression: body "description": "", "defaultPlayerSettings": { "direction": "ltr", - "displayScore": false, - "trackAssessments": false, + "scoring": false, "dragAssist": false }, "theme": "Blank", diff --git a/backend/api/tests/integration/snapshots/integration__jig__create_default-3.snap b/backend/api/tests/integration/snapshots/integration__jig__create_default-3.snap index f7994cf09..83fdb7265 100644 --- a/backend/api/tests/integration/snapshots/integration__jig__create_default-3.snap +++ b/backend/api/tests/integration/snapshots/integration__jig__create_default-3.snap @@ -25,8 +25,7 @@ expression: body "description": "", "defaultPlayerSettings": { "direction": "ltr", - "displayScore": false, - "trackAssessments": false, + "scoring": false, "dragAssist": false }, "theme": "Blank", diff --git a/backend/api/tests/integration/snapshots/integration__jig__get-1.snap b/backend/api/tests/integration/snapshots/integration__jig__get-1.snap index 70832d490..c068ecec6 100644 --- a/backend/api/tests/integration/snapshots/integration__jig__get-1.snap +++ b/backend/api/tests/integration/snapshots/integration__jig__get-1.snap @@ -57,8 +57,7 @@ expression: body "description": "test description", "defaultPlayerSettings": { "direction": "ltr", - "displayScore": true, - "trackAssessments": true, + "scoring": true, "dragAssist": true }, "theme": "Blank", diff --git a/backend/api/tests/integration/snapshots/integration__jig__get-2.snap b/backend/api/tests/integration/snapshots/integration__jig__get-2.snap index b49397a0c..ea12d713f 100644 --- a/backend/api/tests/integration/snapshots/integration__jig__get-2.snap +++ b/backend/api/tests/integration/snapshots/integration__jig__get-2.snap @@ -57,8 +57,7 @@ expression: body "description": "test description", "defaultPlayerSettings": { "direction": "ltr", - "displayScore": true, - "trackAssessments": true, + "scoring": true, "dragAssist": true }, "theme": "Blank", diff --git a/backend/api/tests/integration/snapshots/integration__jig__live_up_to_date_flag-1.snap b/backend/api/tests/integration/snapshots/integration__jig__live_up_to_date_flag-1.snap index a69ed6809..ca09aaba6 100644 --- a/backend/api/tests/integration/snapshots/integration__jig__live_up_to_date_flag-1.snap +++ b/backend/api/tests/integration/snapshots/integration__jig__live_up_to_date_flag-1.snap @@ -32,8 +32,7 @@ expression: body "description": "test description", "defaultPlayerSettings": { "direction": "ltr", - "displayScore": true, - "trackAssessments": true, + "scoring": true, "dragAssist": true }, "theme": "Blank", diff --git a/backend/api/tests/integration/snapshots/integration__jig__live_up_to_date_flag-2.snap b/backend/api/tests/integration/snapshots/integration__jig__live_up_to_date_flag-2.snap index e81cbcd6c..649fc185f 100644 --- a/backend/api/tests/integration/snapshots/integration__jig__live_up_to_date_flag-2.snap +++ b/backend/api/tests/integration/snapshots/integration__jig__live_up_to_date_flag-2.snap @@ -32,8 +32,7 @@ expression: body "description": "test description", "defaultPlayerSettings": { "direction": "ltr", - "displayScore": true, - "trackAssessments": true, + "scoring": true, "dragAssist": true }, "theme": "Blank", diff --git a/backend/api/tests/integration/snapshots/integration__jig__update_and_publish-1.snap b/backend/api/tests/integration/snapshots/integration__jig__update_and_publish-1.snap index a69ed6809..ca09aaba6 100644 --- a/backend/api/tests/integration/snapshots/integration__jig__update_and_publish-1.snap +++ b/backend/api/tests/integration/snapshots/integration__jig__update_and_publish-1.snap @@ -32,8 +32,7 @@ expression: body "description": "test description", "defaultPlayerSettings": { "direction": "ltr", - "displayScore": true, - "trackAssessments": true, + "scoring": true, "dragAssist": true }, "theme": "Blank", diff --git a/backend/api/tests/integration/snapshots/integration__jig__update_and_publish-2.snap b/backend/api/tests/integration/snapshots/integration__jig__update_and_publish-2.snap index 1b3711597..fae3eaa23 100644 --- a/backend/api/tests/integration/snapshots/integration__jig__update_and_publish-2.snap +++ b/backend/api/tests/integration/snapshots/integration__jig__update_and_publish-2.snap @@ -35,8 +35,7 @@ expression: body "description": "asdasdasd", "defaultPlayerSettings": { "direction": "ltr", - "displayScore": true, - "trackAssessments": true, + "scoring": true, "dragAssist": true }, "theme": "Blank", diff --git a/backend/api/tests/integration/snapshots/integration__jig__update_and_publish-3.snap b/backend/api/tests/integration/snapshots/integration__jig__update_and_publish-3.snap index 97bf9d5bb..73cda998b 100644 --- a/backend/api/tests/integration/snapshots/integration__jig__update_and_publish-3.snap +++ b/backend/api/tests/integration/snapshots/integration__jig__update_and_publish-3.snap @@ -32,8 +32,7 @@ expression: body "description": "test description", "defaultPlayerSettings": { "direction": "ltr", - "displayScore": true, - "trackAssessments": true, + "scoring": true, "dragAssist": true }, "theme": "Blank", diff --git a/backend/api/tests/integration/snapshots/integration__jig__update_and_publish-4.snap b/backend/api/tests/integration/snapshots/integration__jig__update_and_publish-4.snap index 7d2f501d1..3f6038ccd 100644 --- a/backend/api/tests/integration/snapshots/integration__jig__update_and_publish-4.snap +++ b/backend/api/tests/integration/snapshots/integration__jig__update_and_publish-4.snap @@ -35,8 +35,7 @@ expression: body "description": "asdasdasd", "defaultPlayerSettings": { "direction": "ltr", - "displayScore": true, - "trackAssessments": true, + "scoring": true, "dragAssist": true }, "theme": "Blank", diff --git a/backend/api/tests/integration/user/snapshots/integration__user__public_user__browse_user_jigs.snap b/backend/api/tests/integration/user/snapshots/integration__user__public_user__browse_user_jigs.snap index 1473b763a..c1ab8774e 100644 --- a/backend/api/tests/integration/user/snapshots/integration__user__public_user__browse_user_jigs.snap +++ b/backend/api/tests/integration/user/snapshots/integration__user__public_user__browse_user_jigs.snap @@ -59,8 +59,7 @@ expression: body "description": "test description", "defaultPlayerSettings": { "direction": "ltr", - "displayScore": true, - "trackAssessments": true, + "scoring": true, "dragAssist": true }, "theme": "Blank", @@ -113,8 +112,7 @@ expression: body "description": "test description", "defaultPlayerSettings": { "direction": "ltr", - "displayScore": true, - "trackAssessments": true, + "scoring": true, "dragAssist": true }, "theme": "Blank", @@ -160,8 +158,7 @@ expression: body "description": "test description", "defaultPlayerSettings": { "direction": "ltr", - "displayScore": true, - "trackAssessments": true, + "scoring": true, "dragAssist": true }, "theme": "Blank", diff --git a/frontend/apps/crates/components/src/share_asset/actions.rs b/frontend/apps/crates/components/src/share_asset/actions.rs index 8f6904bcd..fd1f2423d 100644 --- a/frontend/apps/crates/components/src/share_asset/actions.rs +++ b/frontend/apps/crates/components/src/share_asset/actions.rs @@ -21,7 +21,7 @@ impl ShareAsset { jig_id: state.asset.unwrap_jig().id, settings: JigPlayerSettings { direction: state.direction.get(), - display_score: state.display_score.get(), + scoring: state.scoring.get(), ..Default::default() }, name: Default::default(), diff --git a/frontend/apps/crates/components/src/share_asset/dom.rs b/frontend/apps/crates/components/src/share_asset/dom.rs index a51cf87fa..5cf35870e 100644 --- a/frontend/apps/crates/components/src/share_asset/dom.rs +++ b/frontend/apps/crates/components/src/share_asset/dom.rs @@ -36,7 +36,7 @@ const STR_SHARE_LABEL: &str = "Share on social"; const STR_COPY_LABEL_1: &str = "Copy "; const STR_COPY_LABEL_2: &str = " link"; const STR_COPIED_LABEL: &str = " link copied"; -const STR_DISPLAY_SCORE: &str = "Scoring & Assessment"; +const STR_SCORING: &str = "Scoring & Assessment"; impl ShareAsset { pub fn render(self: Rc, anchor: Dom, slot: Option<&str>) -> Dom { @@ -141,12 +141,12 @@ impl ShareAsset { .child(html!("label", { .prop("slot", "settings") .child(html!("input-switch", { - .prop_signal("enabled", state.display_score.signal()) + .prop_signal("enabled", state.scoring.signal()) .event(clone!(state => move|evt :events::CustomToggle| { - state.display_score.set(evt.value()); + state.scoring.set(evt.value()); })) })) - .text(STR_DISPLAY_SCORE) + .text(STR_SCORING) })) }) // TODO: temporary until we have student-codes for playlists diff --git a/frontend/apps/crates/components/src/share_asset/state.rs b/frontend/apps/crates/components/src/share_asset/state.rs index e97db3c75..b66b40620 100644 --- a/frontend/apps/crates/components/src/share_asset/state.rs +++ b/frontend/apps/crates/components/src/share_asset/state.rs @@ -22,7 +22,7 @@ pub struct ShareAsset { pub copied_student_code: Mutable, // play settings pub direction: Mutable, - pub display_score: Mutable, + pub scoring: Mutable, } impl ShareAsset { @@ -37,7 +37,7 @@ impl ShareAsset { copied_student_url: Mutable::new(false), copied_student_code: Mutable::new(false), direction: Mutable::new(TextDirection::default()), - display_score: Mutable::new(bool::default()), + scoring: Mutable::new(bool::default()), }) } @@ -64,7 +64,7 @@ impl ShareAsset { is_student, quota, direction: self.direction.get(), - display_score: self.display_score.get(), + scoring: self.scoring.get(), ..Default::default() }, ))) diff --git a/frontend/apps/crates/entry/asset/edit/src/edit/sidebar/jig/actions.rs b/frontend/apps/crates/entry/asset/edit/src/edit/sidebar/jig/actions.rs index 5a01902e0..f1e3e16c1 100644 --- a/frontend/apps/crates/entry/asset/edit/src/edit/sidebar/jig/actions.rs +++ b/frontend/apps/crates/entry/asset/edit/src/edit/sidebar/jig/actions.rs @@ -73,14 +73,12 @@ pub fn duplicate_module(state: Rc, module_id: &ModuleId) { pub fn get_player_settings(settings_state: Rc) -> JigPlayerOptions { let direction = settings_state.jig.direction.get_cloned(); - let display_score = settings_state.jig.display_score.get(); - let track_assessments = settings_state.jig.track_assessments.get(); + let scoring = settings_state.jig.scoring.get(); let drag_assist = settings_state.jig.drag_assist.get(); JigPlayerOptions { direction, - display_score, - track_assessments, + scoring, drag_assist, is_student: false, draft_or_live: DraftOrLive::Draft, diff --git a/frontend/apps/crates/entry/asset/edit/src/edit/sidebar/jig/settings/dom/main.rs b/frontend/apps/crates/entry/asset/edit/src/edit/sidebar/jig/settings/dom/main.rs index 32a1765b6..cfd4bbd0f 100644 --- a/frontend/apps/crates/entry/asset/edit/src/edit/sidebar/jig/settings/dom/main.rs +++ b/frontend/apps/crates/entry/asset/edit/src/edit/sidebar/jig/settings/dom/main.rs @@ -12,7 +12,7 @@ use crate::edit::sidebar::jig::settings::{ use super::super::state::JigSettings; -const STR_DISPLAY_SCORE: &str = "Display score"; +const STR_SCORING: &str = "Scoring & Assessment"; // const STR_ASSESSMENT_MODE: &str = "Assessment mode"; // const STR_DRAG_ASSIST: &str = "Drag & Drop assist"; @@ -60,26 +60,16 @@ impl JigSettings { }), html!("label", { .child(html!("input-switch", { - .prop_signal("enabled", state.jig.display_score.signal()) + .prop_signal("enabled", state.jig.scoring.signal()) .event(clone!(state => move|evt :events::CustomToggle| { - state.jig.display_score.set(evt.value()); + state.jig.scoring.set(evt.value()); update_jig_settings(Rc::clone(&state)); })) })) - .text(STR_DISPLAY_SCORE) + .text(STR_SCORING) }), // html!("label", { // .child(html!("input-switch", { - // .prop_signal("enabled", state.jig.track_assessments.signal()) - // .event(clone!(state => move|evt :events::CustomToggle| { - // state.jig.track_assessments.set(evt.value()); - // update_jig_settings(Rc::clone(&state)); - // })) - // })) - // .text(STR_ASSESSMENT_MODE) - // }), - // html!("label", { - // .child(html!("input-switch", { // .prop_signal("enabled", state.jig.drag_assist.signal()) // .event(clone!(state => move|evt :events::CustomToggle| { // state.jig.drag_assist.set(evt.value()); diff --git a/frontend/apps/crates/entry/asset/edit/src/edit/sidebar/jig/settings/state.rs b/frontend/apps/crates/entry/asset/edit/src/edit/sidebar/jig/settings/state.rs index 13361b9ec..b9264e30d 100644 --- a/frontend/apps/crates/entry/asset/edit/src/edit/sidebar/jig/settings/state.rs +++ b/frontend/apps/crates/entry/asset/edit/src/edit/sidebar/jig/settings/state.rs @@ -32,8 +32,7 @@ impl JigSettings { fn get_player_settings(&self) -> JigPlayerSettings { JigPlayerSettings { direction: self.jig.direction.get(), - display_score: self.jig.display_score.get(), - track_assessments: self.jig.track_assessments.get(), + scoring: self.jig.scoring.get(), drag_assist: self.jig.drag_assist.get(), } } diff --git a/frontend/apps/crates/entry/asset/play/src/jig/dom.rs b/frontend/apps/crates/entry/asset/play/src/jig/dom.rs index 3a4f8a5e3..bd3cfe988 100644 --- a/frontend/apps/crates/entry/asset/play/src/jig/dom.rs +++ b/frontend/apps/crates/entry/asset/play/src/jig/dom.rs @@ -159,7 +159,7 @@ impl JigPlayer { dom.child(Sidebar::new(&state).render()) } }) - .apply_if(state.player_options.display_score, clone!(state => move|dom| { + .apply_if(state.player_options.scoring, clone!(state => move|dom| { dom.child(html!("jig-play-points-indicator", { .prop("slot", "indicators") .prop_signal("value", state.points.signal().map(|p| p * 100)) @@ -533,7 +533,7 @@ impl JigPlayer { .prop("autoClose", false) .child(html!("jig-play-done-popup", { .apply(|mut dom| { - if state.player_options.display_score { + if state.player_options.scoring { dom = dom.prop_signal("score", state.points.signal().map(|p| p * 100)); }; if !state.player_options.track_assessments { diff --git a/frontend/apps/crates/entry/classroom/src/codes/jig_codes/dom.rs b/frontend/apps/crates/entry/classroom/src/codes/jig_codes/dom.rs index deb0082e5..49e9fd47d 100644 --- a/frontend/apps/crates/entry/classroom/src/codes/jig_codes/dom.rs +++ b/frontend/apps/crates/entry/classroom/src/codes/jig_codes/dom.rs @@ -46,11 +46,7 @@ impl Component for Rc { })) .child(html!("span", { .class("cell") - .text("Display score") - })) - .child(html!("span", { - .class("cell") - .text("Track assessments") + .text("Scoring & Assessment") })) .child(html!("span", { .class("cell") @@ -98,18 +94,7 @@ impl Component for Rc { .child(html!("span", { .class("cell") .apply(|dom| { - match code.settings.display_score { - true => dom.child(html!("fa-icon", { - .prop("icon", "fa-solid fa-check") - })), - false => dom, - } - }) - })) - .child(html!("span", { - .class("cell") - .apply(|dom| { - match code.settings.track_assessments { + match code.settings.scoring { true => dom.child(html!("fa-icon", { .prop("icon", "fa-solid fa-check") })), diff --git a/frontend/apps/crates/entry/kids/src/student_code/dom.rs b/frontend/apps/crates/entry/kids/src/student_code/dom.rs index d28492410..e723ab8fd 100644 --- a/frontend/apps/crates/entry/kids/src/student_code/dom.rs +++ b/frontend/apps/crates/entry/kids/src/student_code/dom.rs @@ -26,7 +26,7 @@ impl StudentCode { html!("div", { .child_signal(play_jig.name.signal_cloned().map(clone!(state => move |name| { Some(match name { - None if play_jig.settings.display_score => { + None if play_jig.settings.scoring => { state.render_name_input(play_jig.clone()) }, _ => { diff --git a/frontend/apps/crates/utils/src/asset.rs b/frontend/apps/crates/utils/src/asset.rs index a5e6db9c5..2ec8f71de 100644 --- a/frontend/apps/crates/utils/src/asset.rs +++ b/frontend/apps/crates/utils/src/asset.rs @@ -185,10 +185,7 @@ pub struct JigPlayerOptions { pub direction: TextDirection, #[serde(default)] - pub display_score: bool, - - #[serde(default)] - pub track_assessments: bool, + pub scoring: bool, #[serde(default)] pub drag_assist: bool, @@ -220,8 +217,7 @@ impl From for JigPlayerSettings { fn from(options: JigPlayerOptions) -> Self { Self { direction: options.direction, - display_score: options.display_score, - track_assessments: options.track_assessments, + scoring: options.scoring, drag_assist: options.drag_assist, } } @@ -231,8 +227,7 @@ impl From for JigPlayerOptions { fn from(settings: JigPlayerSettings) -> Self { Self { direction: settings.direction, - display_score: settings.display_score, - track_assessments: settings.track_assessments, + scoring: settings.scoring, drag_assist: settings.drag_assist, is_student: false, quota: false, diff --git a/frontend/apps/crates/utils/src/editable_asset/editable_jig.rs b/frontend/apps/crates/utils/src/editable_asset/editable_jig.rs index d573bdc34..1dbb5b7af 100644 --- a/frontend/apps/crates/utils/src/editable_asset/editable_jig.rs +++ b/frontend/apps/crates/utils/src/editable_asset/editable_jig.rs @@ -46,8 +46,7 @@ pub struct EditableJig { pub feedback_positive: Mutable>, pub feedback_negative: Mutable>, pub direction: Mutable, - pub display_score: Mutable, - pub track_assessments: Mutable, + pub scoring: Mutable, pub drag_assist: Mutable, pub other_keywords: Mutable, pub rating: Mutable>, @@ -81,8 +80,7 @@ impl From for EditableJig { feedback_positive: Mutable::new(jig.jig_data.audio_effects.feedback_positive), feedback_negative: Mutable::new(jig.jig_data.audio_effects.feedback_negative), direction: Mutable::new(jig.jig_data.default_player_settings.direction), - display_score: Mutable::new(jig.jig_data.default_player_settings.display_score), - track_assessments: Mutable::new(jig.jig_data.default_player_settings.track_assessments), + scoring: Mutable::new(jig.jig_data.default_player_settings.scoring), drag_assist: Mutable::new(jig.jig_data.default_player_settings.drag_assist), other_keywords: Mutable::new(jig.jig_data.other_keywords), rating: Mutable::new(jig.admin_data.rating), @@ -116,8 +114,7 @@ impl From for EditableJig { feedback_positive: Default::default(), feedback_negative: Default::default(), direction: Default::default(), - display_score: Default::default(), - track_assessments: Default::default(), + scoring: Default::default(), drag_assist: Default::default(), other_keywords: Default::default(), rating: Default::default(), @@ -157,10 +154,8 @@ impl EditableJig { .set(jig.jig_data.audio_effects.feedback_negative); self.direction .set(jig.jig_data.default_player_settings.direction); - self.display_score - .set(jig.jig_data.default_player_settings.display_score); - self.track_assessments - .set(jig.jig_data.default_player_settings.track_assessments); + self.scoring + .set(jig.jig_data.default_player_settings.scoring); self.drag_assist .set(jig.jig_data.default_player_settings.drag_assist); self.other_keywords.set(jig.jig_data.other_keywords); @@ -192,8 +187,7 @@ impl EditableJig { feedback_positive: Mutable::new(self.feedback_positive.get_cloned()), feedback_negative: Mutable::new(self.feedback_negative.get_cloned()), direction: Mutable::new(self.direction.get()), - display_score: Mutable::new(self.display_score.get()), - track_assessments: Mutable::new(self.track_assessments.get()), + scoring: Mutable::new(self.scoring.get()), drag_assist: Mutable::new(self.drag_assist.get()), other_keywords: Mutable::new(self.other_keywords.get_cloned()), rating: Mutable::new(self.rating.get()), @@ -224,8 +218,7 @@ impl EditableJig { }), default_player_settings: Some(JigPlayerSettings { direction: self.direction.get(), - display_score: self.display_score.get(), - track_assessments: self.track_assessments.get(), + scoring: self.scoring.get(), drag_assist: self.drag_assist.get(), }), other_keywords: Some(self.other_keywords.get_cloned()), diff --git a/shared/rust/src/api/method.rs b/shared/rust/src/api/method.rs index fb56b578a..ab9889077 100644 --- a/shared/rust/src/api/method.rs +++ b/shared/rust/src/api/method.rs @@ -2,7 +2,7 @@ use actix_web::{web, Route}; /// Represents a http method. -#[derive(Copy, Clone, Eq, PartialEq)] +#[derive(Copy, Clone, Eq, PartialEq, Debug)] pub enum Method { /// http `DELETE`, used for deleting resources. Delete, diff --git a/shared/rust/src/domain/jig/player.rs b/shared/rust/src/domain/jig/player.rs index fee3f9734..1286ad3f4 100644 --- a/shared/rust/src/domain/jig/player.rs +++ b/shared/rust/src/domain/jig/player.rs @@ -11,12 +11,9 @@ pub struct JigPlayerSettings { /// Text direction, left-to-right or right-to-left #[serde(default)] pub direction: TextDirection, - /// Whether or not to display the score + /// Scoring #[serde(default)] - pub display_score: bool, - /// Whether or not to track assessments - #[serde(default)] - pub track_assessments: bool, + pub scoring: bool, /// Whether or not to enable drag assist #[serde(default)] pub drag_assist: bool, @@ -26,8 +23,7 @@ impl Default for JigPlayerSettings { fn default() -> Self { Self { direction: TextDirection::default(), - display_score: false, - track_assessments: false, + scoring: false, drag_assist: false, } }