1
0
Fork 0
mirror of https://github.com/seanmorley15/AdventureLog.git synced 2025-07-19 12:59:36 +02:00

Fix issues determined from testing series

This commit is contained in:
Sean Morley 2024-11-07 19:48:44 -05:00
parent c7207ccf52
commit b32c780266
5 changed files with 28 additions and 17 deletions

View file

@ -40,6 +40,8 @@ class AdventureSerializer(serializers.ModelSerializer):
for visit in obj.visits.all():
if visit.start_date and visit.end_date and (visit.start_date <= current_date):
return True
elif visit.start_date and not visit.end_date and (visit.start_date <= current_date):
return True
return False

View file

@ -80,6 +80,8 @@
let imageError: string = '';
let wikiImageError: string = '';
let old_display_name: string = '';
images = adventure.images || [];
if (longitude && latitude) {
@ -114,9 +116,10 @@
$: {
if (
reverseGeocodePlace?.display_name &&
adventure.location != reverseGeocodePlace.display_name
(old_display_name != reverseGeocodePlace.display_name || !adventure.location)
) {
adventure.location = reverseGeocodePlace.display_name;
old_display_name = reverseGeocodePlace.display_name;
}
}
@ -569,14 +572,25 @@
<!-- <div class="grid grid-cols-1 gap-4 md:grid-cols-2 lg:grid-cols-3"> -->
<div>
<label for="latitude">{$t('adventures.location')}</label><br />
<input
type="text"
id="location"
name="location"
bind:value={adventure.location}
class="input input-bordered w-full"
/>
<div class="flex items-center">
<input
type="text"
id="location"
name="location"
bind:value={adventure.location}
class="input input-bordered w-full"
/>
{#if reverseGeocodePlace && reverseGeocodePlace.display_name && reverseGeocodePlace.display_name != adventure.location}
<button
class="btn btn-primary ml-2"
type="button"
on:click={() => (adventure.location = reverseGeocodePlace?.display_name)}
>{$t('adventures.set_to_pin')}</button
>
{/if}
</div>
</div>
<div>
<form on:submit={geocode} class="mt-2">
<input

View file

@ -177,6 +177,7 @@
"adventure_create_error": "Failed to create adventure",
"adventure_updated": "Adventure updated",
"adventure_update_error": "Failed to update adventure",
"set_to_pin": "Set to Pin",
"new_adventure": "New Adventure",
"basic_information": "Basic Information",
"adventure_not_found": "There are no adventures to display. Add some using the plus button at the bottom right or try changing filters!",

View file

@ -29,12 +29,6 @@
let count = data.props.count || 0;
$: {
if (count != adventures.length) {
count = adventures.length;
}
}
let totalPages = Math.ceil(count / resultsPerPage);
let currentPage: number = 1;

View file

@ -120,9 +120,9 @@
{#if adventure.latitude && adventure.longitude}
<Marker
lngLat={[adventure.longitude, adventure.latitude]}
class="grid h-8 w-8 place-items-center rounded-full border border-gray-200 bg-{adventure.is_visited
? 'red'
: 'blue'}-300 text-black shadow-2xl focus:outline-2 focus:outline-black"
class="grid h-8 w-8 place-items-center rounded-full border border-gray-200 {adventure.is_visited
? 'bg-red-300'
: 'bg-blue-300'} text-black shadow-2xl focus:outline-2 focus:outline-black"
on:click={togglePopup}
>
<span class="text-xl">