diff --git a/README.md b/README.md index dc98aa7..83dccee 100644 --- a/README.md +++ b/README.md @@ -194,7 +194,7 @@ Then switch to the scanner db: `use scanner` And then add an index: ``` -db.calls.createIndex( {shortName: 1, time: -1, star: -1, talkgroupNum: 1}) +db.calls.createIndex( {shortName: 1, time: -1, talkgroupNum: 1}) ``` ### Upgrading MongoDB diff --git a/backend/controllers/events.js b/backend/controllers/events.js index c84421e..cc98de0 100644 --- a/backend/controllers/events.js +++ b/backend/controllers/events.js @@ -69,7 +69,8 @@ exports.addNewEvent = async function (req, res, next) { calls = calls.sort(compareCalls); event.startTime = new Date(calls[0].time); event.endTime = new Date(calls[calls.length - 1].time); - event.expireTime = event.startTime; + event.expireTime = new Date(); + event.expireTime.setDate(event.startTime.getDate() + 29); calls.forEach((call) => { if (event.shortNames.indexOf(call.shortName) === -1) { event.shortNames.push(call.shortName); diff --git a/frontend/src/Call/components/PlaylistBuilder.js b/frontend/src/Call/components/PlaylistBuilder.js index e62e8c9..92771c8 100644 --- a/frontend/src/Call/components/PlaylistBuilder.js +++ b/frontend/src/Call/components/PlaylistBuilder.js @@ -19,6 +19,7 @@ import { Message } from "semantic-ui-react"; import { useAddNewEventMutation, useGetTalkgroupsQuery } from '../../features/api/apiSlice' +import PlaylistItem from "./PlaylistItem" function PlaylistBuilder(props) { const { shortName } = useParams(); @@ -75,6 +76,17 @@ function PlaylistBuilder(props) { console.log("Dropping: " + callId); addCall(callsData.entities[callId]) } + +const removeItem = (call) => { + if (call) { + const found = playlist.findIndex(c => c._id == call._id); + if (found!=-1) { + playlist.splice(found,1) + setPlaylist([...playlist.sort(compareCalls)]) + } + } +} + let listItems = ""; listItems = playlist.map((call, index) => { @@ -84,16 +96,7 @@ function PlaylistBuilder(props) { tgAlpha = talkgroup.alpha?talkgroup.alpha:tgAlpha; } - const time = new Date(call.time); - const callTime = time.toLocaleTimeString(); - const callDate = time.toLocaleDateString(); - - return (
{eventData.description}