Saving the recurring events in database if they are edited - ruby-on-rails-3

I am making a calender app where someone could edit a task.
I have a task which has got task name, description and due_date. This task has to be repeated on a quarterly basis. If someone goes to the task of the next quarter and clicks on the task, I want an object to be created at that point of time with due_date of this task so that other operations like editing can be done on it.
I am able to show the tasks on calendar but don't know how to start with saving the object thing.
Since I am using ice_cube to make recurring event I thought I could do it with persistence as per the wiki. However I seem to be stuck and don't know how to move forward.
It will be great if someone can point me on how to make this use case

The solution which is working for me is following :-
1) Identify that the event is recurring and not the one which is saved in the database (IceCube will help in this)
2) When click on the event which is recurring pass a parameter with the link (say recurring event)
3) Check in the controller if the parameter is recurring event then create a task in the backend and redirect to the show of that task (while creating the task fill the details of the task in the backend)
Hope this helps

Related

BPM Human Task scheduling

We use Camunda to run business processes but my question is more about general BPM patterns than a specific tool that implement it.
Let suppose the following very simple use case and a homemade application on top of it that use BPM engine API to query tasks and complete them.
Let suppose that Action 1 will be auto assigned to John and Action 2 to Bob. From my comprehension of BPM, when the process start, Action 1 is created and assigned to John. When John complete the Action 1, the Action 2 is created and assigned to Bob. And that's what we want because Bob could not start working on Action 2 if Action 1 is not yet completed. Fine...
Now suppose that as the team manager, I want to schedule activities of John and Bob. I'm thinking about introducing an initial task handled by me to configure a planning.
When the process now start, a new task is created and is assigned to me. I want in my homemade application to query the BPM engine in order to get all tasks (actives and inactives) in order to add planning information (planned start date and due date). For example, I want to specify that:
Action 1 should start on 01/01/2021 and should be closed on 03/01/2020.
Action 2 should start on 04/01/2021 and should be closed on 05/01/2020.
With this kind of information, John and Bob could connect to the task list and see that a "not yet started" task is waiting for them on a specific time range. The main goal of this is to manage a team calendar of activities.
I don't see how to implement that in BPM due to the fact that, in my comprehension, tasks are created when the process reach them so we could not have information about "Not Yet Started" tasks.
Any ideas? Suggestions? Bests practices?
Tx
I asked a question above, but if the answer is "Action 2 still requires Action 1, and I don't want people to see the tasks before their start date." Then the model would look like this -
The timers would be set to the start dates the manager picked. I have a strong opinion that the tasks shouldn't be in the list if the user can't work them. So if they should not work it before the start date, we shouldn't have it in their task list. This is different than say, a report on the status of the process, which certainly can show that we are waiting until date X to issue Action 1. There is also a way to model it so that someone can say "Yeah, you know what, I want to start this now" and trigger the action early from that dashboard.
To have the tasks for John and Bob active at the same time, you could use a parallel gateway ... and then filter the tasks in a custom task list based on the configurations you made ...
If you want to keep the sequence of tasks (which is the better option imho) you can still set variables in your planning task up front and then read these values when the second task is started by registering a TaskListener on your model.

Database design for recurring events with exceptions

I'm building a system that needs to store/manage different types of events. For simplicity, I will focus on designing a calendar (I'm building something slightly different, but calendar is a good analogy and it's easy to reason about). I'd like to hear about possible database/schema design ideas.
Problem Description
I have a calendar with different types of events (for simplicity sake, say there is only 1 type of event: Task). User can add new event for a particular date, edit (change some details, like title or move to another date) or delete. There can be one-time events and recurring events (with different types of recurrence: every X days, every 15th day of the month, every week on Monday; kind of like simple cron). When user moves recurring event, all other instances of this event are moved in the same manner (e.g: +3 days). Important part: recurring events can have exceptions. So, for example, let's say I have an recurring event A which is repeated every 7 days. But I want to change it's date for next week, so instead of Tuesday, it's be assigned to Friday, after that it'll still occur on Tuesday. This "exception" event shouldn't be affected when "parent" event is moved.
Also, every recurring event can have additional info, that is related only to 1 particular instance, e.g: I have the same recurring event A repeated every 7 days, I want to add a note for this week instance that says "X", and I want to add another note for the event A next month that says "Y" - those fields are only visible to that single instances.
Ideas
System with regular, one-time events is pretty straightforward so I won't discuss that and focus only on recurring events.
1. One possible solution is the one that resembles OOP: I can have an Event "class" with fields such as start_date, end_date (can be null), recurrence_type (something like enum with possible values of EVERY_X_DAYS, DAY_OF_WEEK, DAY_OF_MONTH) and recurrence_value (say 7). When user adds new recurring event, I just create such Event in the database. When user wants to change 1 occurrence of this event, I add new entry to the DB of the type/class MovedEvent that "inherits" from Event with different date and has additional field related_to that points to the ID (or UUID, if you will) of the Event that it's related to. But at the same time, I need to keep track of all the MovedEvents (otherwise I'd have 2 events displayed in the same week), so I need to have an array moved_events of IDs that point to all MovedEvents.
Disadvantage: every time I want to display the calendar I need to get Event and select all events from the moved_events, which is not optimal if I'll have a lot of moved events.
2. Another idea is to store every event as a separate record. IMO it's a terrible idea, but I just mentioning it because it's a possibility. Disadvantages: every time I want to edit the main event (e.g: I want to change the event from occurring "every 7 days" to "every 9 days") I need to change every single occurrence of the event. "Exceptions" (changing single instance) is easier, though.
SQL/NoSQL? Scale details
I'm using PostgreSQL in my project, but I have basic knowledge in NoSQL databases and if they are better suited for this kind of a problem, I can use it.
Scale: Let's say I have 5k users, and each will have on average 150 events/week, 40% of which can be "exceptions". Therefore I want to design this system to be efficient.
Similar Questions & Other Resources
I've just started reading Martin Fowler's "Recurring Events for Calendars" (http://martinfowler.com/apsupp/recurring.pdf) but I'm not sure if it applies to my problem and if so, how one would design database schema according to this document (suggestions are welcome).
There are similar questions, but I didn't see any mention of "exceptions" (changing 1 event instance without affecting other), but maybe someone will find these links useful:
Design question: How would you design a recurring event system?
Optimal design for a Database with recurring event
Design option for 'recurring tasks'
Calendar Recurring/Repeating Events - Best Storage Method
What is the best way to represent "Recurring Events" in database?
Sorry for a long question, I wanted to describe the problem well. Yet, I feel that's pretty chaotic, so if you have additional questions, I will happily provide more details. Again, I'd like to hear about possible database/schema design ideas plus any other suggestions. Thank you!
Use iCalendar RRules and ExDates
If it's a recurring event, just store the start/end datetimes and RRules and ExDates for the event.
Use a Materialized View to pre-calculate upcoming actual events, say for the next 30 days or 365 days.
As you are using Postgres, you can use existing python, perl, or javascript RRule libraries (such as dateutil) inside pg function for calculating future events based on the rrules and exdates
UPDATE: check out pg_rrule extension: https://github.com/petropavel13/pg_rrule

How to sum scheduled work hours for a user?

I wonder if it's possible to sum up a user's scheduled work hours?
I have customized the user entity and added a field that I want to show the user's total defined work hours in for the current week. But I don't know how to access the entity containing work hours. The problem is that I'm in an online organization and I can't access the database.
I've tried downloading SDK and of course googling. Since I'm a beginner I haven't found anything useful.
I've found an example for selecting time spans of working hours of a certain user. It's found in the SDK but, given that the example is written as a console application in C#, it might be perceived as complicated an unnecessarily complicated.
Also, it's mentioned that there's a field on the user entity, I assume that for this particular task, JavaScript might be more suitable and such an example I haven't seen.
This page presenting the source code is on MSDN. The bottom line is that you create a service and then execute the below.
QueryScheduleRequest scheduleRequest = new QueryScheduleRequest
{
ResourceId = GetRegardedUserId(),
Start = DateTime.Now,
End = DateTime.Today.AddDays(14),
TimeCodes = new TimeCode[] { TimeCode.Available }
};
QueryScheduleResponse scheduleResponse
= (QueryScheduleResponse)_serviceProxy.Execute(scheduleRequest);
For more information on how to handle the requests to scheduling and working hours see this article and for service appointments look over here.

How to set Custom Fields Notifications in HP Project and Portfolio Management(PPM)?

I am using HP Project and Portfolio Management(PPM) tool and I am adding a custom field in my request type which has date as value. Now my requirement is to send the email notifications to the users once the date mentioned in the custom field crosses the system date.
I had tried to set the notification for field level from Notification tab but not getting the custom fields in the list. All the fields, which is available, are pre-configured fields.
So, can anyone suggest me how to implement this requirement? And also where the changes need to be done If any required to implement this?
Please answer in detail and also reply soon.
Thanks in advance!!
PPM notifications can be configured on pre-defined events, like a certain transition, or timeout etc...
One possible solution for this scenario is to have timeouts on your decision step. Time out goes to an execution step, which checks for the date condition. If the condition is met it fires the notification. Else it just returns to the original decision step.
The downside of this work around is that there will be transaction details added once daily. Also the last update date of the request keeps updating daily, which is not ideal if you want to track what was the last time an end user update the request.
It is a workaround cause of the restrictions around notification events.
And if you have a large workflow, I would not recommend this work around.

SharePoint, notification email workflow

I was wondering if anyone could possibly help me with my SharePoint 2010 issue. I recently created a CRM System within SharePoint for my small business which utilizes a email notification workflow. The workflow is triggered when the 'Action Needed' field has a 'yes' value, this means that 2 days after the information is created or edited the workflow will notify the particular user that further action is needed.
Previous thread with image of the workflow
Now this is great if myself or other members of the team are only inputting a couple of items but I found out the hard way when i keyed in 20 or so items and received 20 individual emails which is irritating as you can imagine.
So on to my issue, I would like the email notifications to be grouped together in one email so it's more efficient and avoids the need for individual emails. So when one particular user creates or edits multiple records instead of separate email notifications I would like it all in one email. So is this possible while using SharePoint workflows? If it is possible and how would I go about expanding my current workflow to achieve this?
I have already asked this question in the dedicated SharePoint area to no prevail, I could really do with the help also if what I am asking is impossible then could someone at least say so.
Thanks very much to anyone who contributes and helps me with my problem.
If you are using SharePoint Designer , then this is not problem. This is because each workflow can access the data on which List Item the workflow is triggered.
However, this is definitely possible using a custom workflow or an event Receiver.
http://msdn.microsoft.com/en-us/library/ms437502(v=office.14).aspx