Now with updated_on date times. Other improvements and clean up.

This commit is contained in:
Scott Idem
2024-09-13 16:20:56 -04:00
parent 3d34e30c63
commit 59eed57dec
4 changed files with 45 additions and 17 deletions

View File

@@ -52,15 +52,7 @@ let tmp_opt_out: key_val = {
publication_in_app: false
};
onMount(() => {
console.log('Events Session [slug]: form_agree.svelte');
// console.log(`$events_slct.event_presenter_id:`, $events_slct.event_presenter_id);
console.log(`$lq__event_presenter_obj:`, $lq__event_presenter_obj);
// console.log($lq__event_presenter_obj.data_json);
});
// Functions and Logic
async function handle_submit_form(event) {
console.log('*** handle_submit_form() ***');
@@ -81,10 +73,15 @@ async function handle_submit_form(event) {
opt_out_do.optout_transcription_and_publication = opt_out_di.optout_transcription_and_publication??false;
opt_out_do.optout_publication_in_app = opt_out_di.optout_publication_in_app??false;
opt_out_do.optout_updated_on = new Date().toISOString();
console.log(`opt_out_do:`, opt_out_do);
let data_out = {
data_json: opt_out_do,
data_json: {
...$lq__event_presenter_obj.data_json,
...opt_out_do
}
}
ae_promises.update__event_presenter_obj = await handle_update__event_presenter({

View File

@@ -20,6 +20,8 @@ let ae_promises: key_val = {};
// let ae_tmp: key_val = {};
// let ae_triggers: key_val = {};
let poc_type = $events_loc.pres_mgmt.label__session_poc_type ?? 'poc';
$events_sess.pres_mgmt.disable_submit__opt_out = false;
let tmp_agree = false;
@@ -51,12 +53,36 @@ async function handle_submit_form(event) {
opt_out_do.optout_transcription_and_publication = opt_out_di.optout_transcription_and_publication??false;
opt_out_do.optout_publication_in_app = opt_out_di.optout_publication_in_app??false;
opt_out_do.optout_updated_on = new Date().toISOString();
console.log(`opt_out_do:`, opt_out_do);
let data_out = {
data_json: opt_out_do,
let event_session_data = {poc_kv_json: $lq__event_session_obj.poc_kv_json};
console.log('event_session_data:', event_session_data);
// Check if poc_type exists in the event_session_data.poc_kv_json
if (!event_session_data.poc_kv_json[poc_type]) {
event_session_data.poc_kv_json[poc_type] = {};
}
event_session_data.poc_kv_json[poc_type] = {
...event_session_data.poc_kv_json[poc_type],
...opt_out_do
};
// let poc_kv_json_type = $lq__event_session_obj.poc_kv_json[poc_type];
// let data_out: key_val = {
// // data_json: opt_out_do,
// poc_kv_json: {
// [poc_type]: {
// poc_kv_json_type,
// ...opt_out_do
// }
// }
// }
// ae_promises.update__event_presenter_obj = await handle_update__event_presenter({
// obj_type: 'event_presenter',
// obj_id: $lq__event_session_obj?.event_presenter_id_random,
@@ -78,7 +104,7 @@ async function handle_submit_form(event) {
ae_promises.update__event_session_obj = events_func.update_ae_obj__event_session({
api_cfg: $ae_api,
event_session_id: $lq__event_session_obj?.event_session_id_random,
data_kv: data_out,
data_kv: event_session_data,
log_lvl: log_lvl,
})
.then(function (update_result) {
@@ -148,7 +174,7 @@ async function handle_submit_form(event) {
class="checkbox variant-ghost-warning checked:variant-filled-warning hover:variant-filled-error"
id="optout_audio"
name="optout_audio"
checked={$lq__event_session_obj.data_json?.optout_audio}
checked={$lq__event_session_obj.poc_kv_json[poc_type]?.optout_audio}
value={true}
>
Opt-out - Audio Reproduction of Presentation
@@ -162,7 +188,7 @@ async function handle_submit_form(event) {
class="checkbox variant-ghost-warning checked:variant-filled-warning hover:variant-filled-error"
id="optout_video"
name="optout_video"
checked={$lq__event_session_obj.data_json?.optout_video}
checked={$lq__event_session_obj.poc_kv_json[poc_type]?.optout_video}
value={true}
>
Opt-out - Video Reproduction of Presentation
@@ -176,7 +202,7 @@ async function handle_submit_form(event) {
class="checkbox variant-ghost-warning checked:variant-filled-warning hover:variant-filled-error"
id="optout_transcription_and_publication"
name="optout_transcription_and_publication"
checked={$lq__event_session_obj.data_json?.optout_transcription_and_publication}
checked={$lq__event_session_obj.poc_kv_json[poc_type]?.optout_transcription_and_publication}
value={true}
>
Opt-out - Transcription and Publication of Presentation on LCI Website
@@ -190,7 +216,7 @@ async function handle_submit_form(event) {
class="checkbox variant-ghost-warning checked:variant-filled-warning hover:variant-filled-error"
id="optout_publication_in_app"
name="optout_publication_in_app"
checked={$lq__event_session_obj.data_json?.optout_publication_in_app}
checked={$lq__event_session_obj.poc_kv_json[poc_type]?.optout_publication_in_app}
value={true}
>
Opt-out - Publication of Presentation on LCI Congress App

View File

@@ -140,6 +140,7 @@ $: if (browser && ae_tmp.biography === null && $lq__event_session_obj?.poc_kv_js
}
event_session_data.poc_kv_json[poc_type]['biography'] = ae_tmp.biography;
event_session_data.poc_kv_json[poc_type]['biography_updated_on'] = new Date().toISOString();
ae_promises.update__event_session_obj = events_func.update_ae_obj__event_session({
api_cfg: $ae_api,

View File

@@ -1400,6 +1400,10 @@ $: if ($lq__event_presenter_obj) {
let event_presenter_data = {
'biography': ae_tmp.biography,
'data_json': {
...$lq__event_presenter_obj.data_json,
'biography_updated_on': new Date().toISOString()
},
};
ae_promises.update__event_presenter_obj = events_func.update_ae_obj__event_presenter({