I've a data model and i have an issue for executing a request.
Here's my model :
I would like to get all the expenses associated to one specific event.
Do you think that my model is wrong ?
For more explanations this is how i set my data in the data base : I have 2 types of event : 'Event' and 'Party'
A guest is associated to 1 or n expenses and an expense is associated to 1 or n guests. Thats why i've created my entity "Transaction".
A transaction has 2 types : "Paid" and "Beneficied" because a Guest can pay an expense and can be a beneficiary too.
Here's how i work with theses entities : For one expense in one event, a guest pays this expense for all the other guests, so i create a transaction associated to this guest and the expense with the type 'Paid' and a has many transactions as my event's guests associated to the same expense but with the type "Beneficied".
I don't know i'm very clear in my explonations...
EDIT
As people doesn't really understand my question, i'll explain how my application does work.
The main purpose of my application is to rebalance expenses between people for a party (birthday, sushi party, etc.) or an event (vacations, week-end, etc.).
My application is already on the Apple store : iVent. But it doesn't works very well that's why i want to update it using core data :).
So, how doest it work ?
The user create an event and select the type of the event
For a party :
I get the iPhone contact and show them on a tableview, the user check which contact is invited to the party.
Then for each event, i have a Grocery list. I get that grocery list from a plist which can be modify by the user as "Default grocery list". But, for each event, the user can delete all the groceries, it won't affect the plist.
My groceries are sorted by categories (Drinks, meals, furnitures, alcohols, etc.). The user selects which grocery he wants for example 2 six-packs, 3 bottle of Red wine etc. Then he links a Grocery to a Guest : Paul will buy 1 six-packs and 1 bottle of red wine, Amy 1 six-pack etc.
Then i allow the user to give the price for each assigned groceries and to set which guest is beneficiary for this grocery. For example Anna doesn't drink alcohol, so she doesn't want to pay for any alcohol when the user will rebalance all the price between the user.
For an event, the process is different :
The user only check the invited guest for the event creation. Then during the event the user will put in the data base all the expenses made.
For exemple Paul and Anna paid gas for everyone, so we set Paul and Anna as buyers of an expense and Paul, Anna, Maurice and Mike as beneficiary because they all were in the car for the trip.
We can set different prices for the buyers for example the gas cost 50$ then Anna paid 20$ and Mike 30$.
It's the same for the beneficiaries : For example Mike came only at middle of the trip so he will pay (after the rebalance) only 12.5% of the price for the gas and not 25% as default (because they were 4 in the car ^^)
I know it's a little confusing to understand but that's why i came here for help ^^
Basically that's how my application works, the version on the Appstore does already all of these features but not very well.
Here's my all data model :
I hope you'll understand now my problem :)
I'd like to know if my model is Ok and how can i list all the expenses for an Event (not a party) with this model configuration.