offer need issue fixed

This commit is contained in:
Anton Tranelis 2024-05-08 11:24:34 +02:00
parent c99abae51d
commit ed959e8076
2 changed files with 4 additions and 37 deletions

View File

@ -105,11 +105,11 @@ export function OverlayItemProfileSettings() {
setNeeds([]);
setRelations([]);
item?.offers?.map(o => {
const offer = tags.find(t => t.id === o.tags_id);
const offer = tags?.find(t => t.id === o.tags_id);
offer && setOffers(current => [...current, offer])
})
item?.needs?.map(o => {
const need = tags.find(t => t.id === o.tags_id);
const need = tags?.find(t => t.id === o.tags_id);
need && setNeeds(current => [...current, need])
})
item.relations?.map(r => {
@ -133,7 +133,7 @@ export function OverlayItemProfileSettings() {
let offer_updates: Array<any> = [];
//check for new offers
offers.map(o => {
offers?.map(o => {
const existingOffer = item?.offers?.find(t => t.tags_id === o.id)
existingOffer && offer_updates.push(existingOffer.id)
if (!existingOffer && !tags.some(t => t.id === o.id)) addTag({ ...o, offer_or_need: true })
@ -142,7 +142,7 @@ export function OverlayItemProfileSettings() {
let needs_updates: Array<any> = [];
needs.map(n => {
needs?.map(n => {
const existingNeed = user?.needs.find(t => t.tags_id === n.id)
existingNeed && needs_updates.push(existingNeed.id)
!existingNeed && needs_updates.push({ items_id: item?.id, tags_id: n.id })

View File

@ -1,33 +0,0 @@
export const places = [{
"id": 51,
"name": "Stadtgemüse",
"text": "Stadtgemüse Fulda ist eine Gemüsegärtnerei in Maberzell, die es sich zur Aufgabe gemacht hat, die Stadt und seine Bewohner:innen mit regionalem, frischem und natürlich angebautem Gemüse mittels Gemüsekisten zu versorgen. Es gibt also jede Woche, von Frühjahr bis Herbst, angepasst an die Saison eine Kiste mit schmackhaftem und frischem Gemüse für euch, welche ihr direkt vor Ort abholen könnt. \r\n\r\nhttps://stadtgemuese-fulda.de",
"position": { "type": "Point", "coordinates": [9.632435, 50.560342] },
"tags": [9,13],
},
{
"id": 166,
"name": "Weidendom",
"text": "free camping",
"position": { "type": "Point", "coordinates": [9.438793, 50.560112] },
"tags": [10,11]
}];
export const events = [
{
"id": 423,
"name": "Hackathon",
"text": "still in progress",
"position": { "type": "Point", "coordinates": [9.5, 50.62] },
"start": "2022-03-25T12:00:00",
"end": "2022-05-12T12:00:00",
"tags": [10]
}
]
export const tags = [
{ "id": "Gardening", "color": "#008e5b" },
{ "id": "Art", "color": "#fdc60b" },
{ "id": "Nature", "color": "#8cbb26" },
{ "id": "Market", "color": "#2a71b0" }
]