Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #71 #76

Merged
merged 2 commits into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,17 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Calendar Versioning](https://calver.org/) (`YYYY.MM.MICRO-TAG`).

## [v2024.11.3-beta] - 2024-11-15

### Fixed

- Fixed bug in AddSessionPopup, where the venue foreign key was not added to the payload for sessions associated with existing venues (PR [#76](https://github.com/felix-schott/jamsessions/pull/76))
- Fixed bug in Postgres function `sessions_on_date()` that resulted in `NthOfMonth` sessions being incorrectly included in query results ([#72](https://github.com/felix-schott/jamsessions/pull/72))

### Added

- Added `Fortnightly` interval (PR [#75](https://github.com/felix-schott/jamsessions/pull/75))

## [v2024.11.2-beta] - 2024-11-13

### Added
Expand Down
46 changes: 22 additions & 24 deletions frontend/src/lib/AddSessionPopup.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
Genre,
Interval,
type SessionProperties,
type SessionPropertiesWithVenue,
type VenueProperties,
type VenuesFeatureCollection
} from '../types';
Expand All @@ -31,8 +32,6 @@
let venuePostcode: string = $state('');
let venueWebsite: string = $state('');

let venueParams: VenueProperties;

let venuesLoaded: boolean = $state(false);

let newVenueHidden = $derived(venueId != 'new-venue' && venuesLoaded);
Expand All @@ -55,6 +54,23 @@
const onSubmit = async (ev: MouseEvent) => {
ev.preventDefault();

let d = new Date(sessionDate);
let sessionParams: SessionProperties | SessionPropertiesWithVenue = {
session_name: sessionName,
description: sessionDescription,
interval: sessionInterval!,
start_time_utc: new Date(
d.getFullYear(),
d.getMonth(),
d.getDate(),
...sessionTimeStart.split(':').map((i) => parseInt(i))
).toISOString(),
duration_minutes: minutesBetweenTimestamps(sessionTimeStart, sessionTimeFinish),
genres: Array.from(document.querySelectorAll('.genre-checkbox:checked')).map(
(i) => i.id.replace('session-genre-', '') as Genre
),
session_website: sessionWebsite
};
// add venue if necessary
if (venueId == 'new-venue') {
if (venueName === '') {
Expand All @@ -73,7 +89,7 @@
if (venueWebsite === '') {
alert('Please add the website of the venue');
}
venueParams = {
let venueParams: VenueProperties = {
venue_name: venueName,
address_first_line: venueAddress1,
address_second_line: venueAddress2 ? venueAddress2 : undefined,
Expand All @@ -84,29 +100,11 @@
(i) => i.id.replace('venue-backline-', '') as Backline
)
};
Object.assign(sessionParams, venueParams);
} else {
sessionParams['venue'] = parseInt(venueId);
}
// add session (with venue if applicable)
try {
let d = new Date(sessionDate);
let sessionParams: SessionProperties = {
session_name: sessionName,
description: sessionDescription,
interval: sessionInterval!,
start_time_utc: new Date(
d.getFullYear(),
d.getMonth(),
d.getDate(),
...sessionTimeStart.split(':').map((i) => parseInt(i))
).toISOString(),
duration_minutes: minutesBetweenTimestamps(sessionTimeStart, sessionTimeFinish),
genres: Array.from(document.querySelectorAll('.genre-checkbox:checked')).map(
(i) => i.id.replace('session-genre-', '') as Genre
),
session_website: sessionWebsite
};
if (venueParams) {
Object.assign(sessionParams, venueParams); // merge venue and session params - postSession can handle a new venue too
}
await postSession(sessionParams);
alert(
"Thank you for submitting a new session! We'll review your suggestions and apply the changes. If there is anything else, you can email felix.schott@proton.me"
Expand Down