Skip to content

Commit

Permalink
Bugfix/537 datepicker fixes (#538)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
john-labbate authored Apr 17, 2024
1 parent 91e8d5b commit afcd620
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 43 deletions.
73 changes: 31 additions & 42 deletions training-front-end/src/components/ValidatedDatepicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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);
}
Expand All @@ -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 = '';
Expand Down Expand Up @@ -105,46 +126,14 @@
:name="props.name + '-month'"
aria-describedby="mdHint"
:required="validator.$dirty"
@input="updateDate"
@change="updateMonth($event.target.value)"
>
<option value="">
- Select -
</option>
<option value="0">
01 - January
</option>
<option value="1">
02 - February
</option>
<option value="2">
03 - March
</option>
<option value="3">
04 - April
</option>
<option value="4">
05 - May
</option>
<option value="5">
06 - June
</option>
<option value="6">
07 - July
</option>
<option value="7">
08 - August
</option>
<option value="8">
09 - September
</option>
<option value="9">
10 - October
</option>
<option value="10">
11 - November
</option>
<option value="11">
12 - December
<option
v-for="option in options"
:key="option.value"
:value="option.value"
>
{{ option.txt }}
</option>
</select>
</div>
Expand Down
2 changes: 1 addition & 1 deletion training/tests/test_api_gspc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit afcd620

Please sign in to comment.