From afcd620b4995d05b965bad627e3e8a54fa71ef88 Mon Sep 17 00:00:00 2001 From: John Labbate <90406009+john-labbate@users.noreply.github.com> Date: Wed, 17 Apr 2024 09:00:05 -0400 Subject: [PATCH] Bugfix/537 datepicker fixes (#538) * update agencie stat to 250 from 560. * wip testing optional params in login destination. * Create placeholder gspc registration page and place it behind login. Also allow for params to be passed into the login redirect. * fix the failing tests. * Resolve error thrown by test. * Code cleanup. * Fix issues with date picker componate. --- .../src/components/ValidatedDatepicker.vue | 73 ++++++++----------- training/tests/test_api_gspc.py | 2 +- 2 files changed, 32 insertions(+), 43 deletions(-) diff --git a/training-front-end/src/components/ValidatedDatepicker.vue b/training-front-end/src/components/ValidatedDatepicker.vue index dacb69de..f380995b 100644 --- a/training-front-end/src/components/ValidatedDatepicker.vue +++ b/training-front-end/src/components/ValidatedDatepicker.vue @@ -26,6 +26,22 @@ }, }); + const options = [ + { txt: '- Select -', value: ""}, + { txt: '01 - January', value: 0 }, + { txt: '02 - February', value: 1 }, + { txt: '03 - March', value: 2 }, + { txt: '04 - April', value: 3 }, + { txt: '05 - May', value: 4 }, + { txt: '06 - June', value: 5 }, + { txt: '07 - July', value: 6 }, + { txt: '08 - August', value: 7 }, + { txt: '09 - September', value: 8 }, + { txt: '10 - October', value: 9 }, + { txt: '11 - November', value: 10 }, + { txt: '12 - December', value: 11 } + ] + const emit = defineEmits(['update:modelValue']); const error_id = computed(() => props.name + '-input-error-message'); @@ -36,12 +52,17 @@ year: '' }); + const updateMonth = (selectedValue) => { + user_input.month = selectedValue; + updateDate() + } + const updateDate = () => { const year = user_input.year; const month = user_input.month; const day = user_input.day; if (year.length == 4 && month && day) { - const newDate = new Date(Date.UTC(year, month, day, '00', '00', '00')); + const newDate = new Date(year, month, day, '00', '00', '00'); if (!isNaN(newDate)) { emit('update:modelValue', newDate); } @@ -51,9 +72,9 @@ watch(() => props.modelValue, (newValue) => { const newDate = new Date(newValue); if (!isNaN(newDate)) { - user_input.day = newDate?.getDate() + user_input.day = String(newDate?.getDate()) user_input.month = newDate?.getMonth() - user_input.year = newDate?.getFullYear() + user_input.year = String(newDate?.getFullYear()) } else{ user_input.day = ''; user_input.month = ''; @@ -105,46 +126,14 @@ :name="props.name + '-month'" aria-describedby="mdHint" :required="validator.$dirty" - @input="updateDate" + @change="updateMonth($event.target.value)" > - - - - - - - - - - - - - diff --git a/training/tests/test_api_gspc.py b/training/tests/test_api_gspc.py index 658b3ef4..39ba3e20 100644 --- a/training/tests/test_api_gspc.py +++ b/training/tests/test_api_gspc.py @@ -95,7 +95,7 @@ def test_gspc_invite_sends_emails_to_valid_emails(self, send_gspc_invite_email, @patch('training.config.settings', 'JWT_SECRET', 'super_secret') @patch('training.api.api_v1.gspc.send_gspc_invite_email') - def test_gspc_invite_loggs_emails(self, send_gspc_invite_email, goodJWT, standard_payload, fake_gspc_invite_repo): + def test_gspc_invite_logs_emails(self, send_gspc_invite_email, goodJWT, standard_payload, fake_gspc_invite_repo): '''Given 2 valid emails logger logs emails sent''' with patch('training.api.api_v1.gspc.logging') as logger: post_gspc_invite(standard_payload, goodJWT)