I am looking for a booking system and I need to show all available users on a particular day / time is. / P>
While thinking about it, I am going to set up a table to pay attention when people are not available and assume that they are otherwise available to me. Had to keep it when it would not be available, and then date_end
The problem now occurs when I am trying to book a meeting, if I want to book something from 11:00 to 13:00 on Tuesday, need to bring a list of those people Which are then available, i.e. there are no vacancies reserved during that time.
Any thoughts or thoughts? I am using Ruby on Rails, if it interferes with someone's ideas / help barriers.
This is a way of model it. Say we have a model 'engagement' in which there is an early day, the end of the day and the end of the name. There are many users of an engagement, through a second segment table called 'User_engagement' (with the same user ignition model), we have
user has_many: user_negegements_my: engagement ,: Via = & gt; : User_engagements Engagement # Fields - Initial_at, And_at (both timeline) has_many: user_engagements has_many: users ,: through = & gt; : User_engagements UserEngagement belong_to: User belongs_to: Engagement We now have a simple simple schema. An engagement is basically something that is happening, and that user's model model Users who have been booked to do this, we have a notion (code is not written in) that when they are doing something they are not available to do anything else.
Our next task is to write a method that provides users within a certain time period, a new engagement ie Therefore, we engage in an engagement and we want all those users who do not have an engagement that crosses with our new engagement. I think the easiest way to do this may be to find all those users who have crossing-over engagement and then return all those users who are not. If you know what I mean. A more accurate way to say E1 ends with E1 that E2 starts before the end of e1 and ends after the beginning of E1.
This creates a way of an engagement object because it is entirely dependent on one's engagement data.
#in engagement def unavailable_user_ids User.find (: All ,: included = & gt; [: user_engagements], select => "users.id" ,: conditions = & gt; ; ["User_engagements.starts_at & lt ;? and user_engagements.ends_at>?, Self., _, Self starts_at]). Archive (& amp; id) and deaf available_uppressors User.find (: all, terms = & Gt; ["Not in ID (?)", Itself. Missing_user_iids]) I think that in a query there is a more efficient way to get it but I can use my finger Can not put enough on SQL
Comments
Post a Comment