Mon, Tue, Fri at 8 AM Temporal Expression:

https://demo-trunk.ofbiz.apache.org/webtools/control/editTemporalExpression?tempExprId=MON_TUE_FRI_08

The Work Effort:

https://demo-trunk.ofbiz.apache.org/workeffort/control/EditWorkEffort?workEffortId=10015

The Calendar:

https://demo-trunk.ofbiz.apache.org/workeffort/control/calendar?period=month

Everything works as expected as far as I can tell.

-Adrian


Vikas Mayur wrote:
Yes, I have set up the estimated milliseconds on the corresponding work
effort to 14,400,000 (4 hours).

Regards
Vikas

On Tue, Apr 20, 2010 at 8:14 PM, Adrian Crum <[email protected]> wrote:

Either expression should work.

Did you give the Work Effort a duration (estimated milliseconds)?


-Adrian

Vikas Mayur wrote:

Hi Adrian,

Thanks for your reply again. I tested the schedule with a similar
expression
as you mentioned but with a small change to the day of week range as
below.

Morning - DayOfWeekRange(Saturday, Sunday) [SAT_TO_SUN]
Afternoon- DayOfWeekRange(Saturday, Sunday) [SAT_TO_SUN]
Evening - DayOfWeekRange(Monday, Friday) [MON_TO_FRI]

Every thing worked fine except again the day and week view for Sunday is
not
showing up.

Also regarding keeping unions in the DayOfWeekRange was to make the
expression a little more flexible.

For example if a user selects Monday, Tuesday and Friday for morning
availability (and not consecutive days) then following the example in one
of
your tutorials (

https://cwiki.apache.org/confluence/display/OFBENDUSER/Temporal+Expressions
)
the expression for morning schedule would be

 Intersection:
  HourRange(08,08)  [HOUR_08]
  MinuteRange(00,00)  [MINUTE_00]
  Union:
      DayOfWeekRange(Monday, Tuesday)  [create MON_THRU_TUE]
      DayOfWeekRange(Friday, Friday)

OR

 Intersection:
  HourRange(08,08)  [HOUR_08]
  MinuteRange(00,00)  [MINUTE_00]
  Union:
      DayOfWeekRange(Monday, Monday)
      DayOfWeekRange(Tuesday, Tuesday)
      DayOfWeekRange(Friday, Friday)

But with the above expression the schedule (keeping the expression for
Afternoon and Evening as same) is not evaluating correctly on the
calendar.

Please let me know your thoughts.

Regards
Vikas



On Sat, Apr 17, 2010 at 8:39 PM, Adrian Crum <[email protected]>
wrote:

 Don't forget that DayOfWeekRange is a range - so the DayOfWeekRange
unions
aren't needed.

Also keep in mind that the calendar views will default to the length of
the
displayed period (all day / all week) if you don't set an event/task
length.

This is what your temporal expression should look like -

Union:
 Intersection:
  HourRange(08,08)  [HOUR_08]
  MinuteRange(00,00)  [MINUTE_00]
  DayOfWeekRange(Saturday, Tuesday)  [create SAT_THRU_TUE]
 Intersection:
  HourRange(12,12)  [HOUR_12]
  MinuteRange(00,00)  [MINUTE_00]
  DayOfWeekRange(Saturday, Sunday)  [SAT_TO_SUN]
 Intersection:
  HourRange(16,16)  [HOUR_16]
  MinuteRange(00,00)  [MINUTE_00]
  DayOfWeekRange(Saturday, Sunday)  [SAT_TO_SUN]

I tried that expression on my local copy. I set the work effort's
estimated
milliseconds to one hour. All three views displayed correctly.

-Adrian


--- On Sat, 4/17/10, Vikas Mayur <[email protected]> wrote:

 From: Vikas Mayur <[email protected]>
Subject: Re: Scheduling user's week using Temporal Expressions
To: [email protected]
Date: Saturday, April 17, 2010, 12:04 AM
Hi Adrian,

Thanks for your reply. Now I have the calender schedule
setup to certain
extent. May be you can tell me If I am wrong again.

I tested it with two schedules basically.

1. A customer is available on Morning, Afternoon and
Evening on Saturday and
Sunday. The schedule in all view (day, week, month) of the
calender is
showing up correctly. I set up this as following.

Union:
   Intersection:
           HourRange(08,00)

MinuteRange(00,00)
           Union:

DayOfWeekRange(Saturday, Saturday)

DayOfWeekRange(Sunday, Sunday)
   Intersection:
           HourRange(12,00)

MinuteRange(00,00)
           Union:

DayOfWeekRange(Saturday, Saturday)

DayOfWeekRange(Sunday, Sunday)
   Intersection:
           HourRange(16,00)

MinuteRange(00,00)
           Union:

DayOfWeekRange(Saturday, Saturday)

DayOfWeekRange(Sunday, Sunday)


2. I extended this schedule to include Monday and Tuesday
morning slot so
added these days in the union expression for morning.

Union:
   Intersection:
           HourRange(08,00)

MinuteRange(00,00)
           Union:

DayOfWeekRange(Saturday, Saturday)

DayOfWeekRange(Sunday, Sunday)

DayOfWeekRange(Monday, Monday)

DayOfWeekRange(Tuesday, Tuesday)
   Intersection:
           HourRange(12,00)

MinuteRange(00,00)
           Union:

DayOfWeekRange(Saturday, Saturday)

DayOfWeekRange(Sunday, Sunday)
   Intersection:
           HourRange(16,00)

MinuteRange(00,00)
           Union:

DayOfWeekRange(Saturday, Saturday)

DayOfWeekRange(Sunday, Sunday)

Results:
1. Month view is coming fine i.e. event is showing up on
Saturday, Sunday,
Monday and Tuesday.
2. Week view - Event is not showing up for Sunday but is
coming fine for
rest of the three days.
3. Day view - Monday 8 AM is only showing up.

Expected:
#2 - Event should show up on Sunday as well in week view.
#3 - Event should show up on Tuesday 8 AM and on all the
three slots for
Saturday and Sunday in day view.

Either again I am not setting up it correctly or this could
be a problem
with the events not rendered correctly on the calendar.

Please let me know your thoughts.

Regards
Vikas

On Fri, Apr 16, 2010 at 11:23 PM, Adrian Crum <[email protected]>
wrote:

 There are a few things wrong here.
I think you are misunderstanding the purpose of

difference. A difference is

a logical AND NOT. So, the exclude expression should

be temporally included

in the include expression. Example: Include Monday

through Friday, but

exclude Wednesday under certain conditions.

You can't use a difference expression to indicate when

a user is not

available. That isn't its purpose.

User availability is called transparency in Work

Effort. So, you need to

set up two work efforts - one for when the user is

available, and one for

when the user isn't available. Set each work effort's

transparency

accordingly. Then create two temporal expressions -

one for available and

one for not available. Then assign those expressions

to the appropriate work

efforts.

The calendar should show the two schedules. You can

then write code around

the transparency.

-Adrian


Vikas Mayur wrote:

 Hi,
First of all sorry for the long post.

I was working on a problem where I have to

schedule a week per user. The
schedule of all the upcoming weeks remains the
same until user do any
changes. A day of the week is divided into 3 slots
namely Morning,
Afternoon
and Evening.

User may or may not be available on a particular

slot on a particular day
of
the week. I need to capture this data for every

customer in the system.
The data will be used by the administrator to send
invitation to those
user
that are available on the same slot on a

particular day.
For this I  have divided 12 hrs schedule of a
day into three slots of 4
hrs
namely a Morning slot from 0800hr 1200hr,

afternoon slot from 1200hr to
1600hr and evening slot from 1600hr to 2000hr.
Then I created the schedule for a user as below.

Union:
  Difference: // RESULT: User is

available in morning slot on Saturday
and
Sunday only.
      Include:

 Intersection: // User is available in morning slot for
entire

week.
      MinuteRange(0, 0)
     HourRange(08, 08) // Starts at 0800hr
     DayOfWeekRange(Saturday, Sunday)

      Exclude:
 Intersection: // User is not available in morning slot from
Monday thru Friday
  DayOfWeekRange(Monday, Friday)
  Difference: // User is available in
afternoon slots on Saturday and
Sunday only.
      Include:

 Intersection:
     MinuteRange(0, 0)
     HourRange(12, 12) // Starts at 1200hr
     DayOfWeekRange(Saturday, Sunday)

      Exclude:
 Intersection:
 DayOfWeekRange(Monday, Friday)

  Difference: // User is available in
evening slot for entire week except
on Saturday and Sunday.
      Include:

 Intersection:
     MinuteRange(0, 0)
     HourRange(16, 16) // Starts at 1600hr
     DayOfWeekRange(Saturday, Sunday)

      Exclude:
 Intersection:
 DayOfWeekRange(Saturday, Saturday)
 DayOfWeekRange(Sunday, Sunday)

When I see the schedule in the Work Effort >

Calendar,  the calendar is
only
showing up event for Saturday and Sunday (user is

available in morning and
afternoon slots on these two days and which is
correct) and not for rest
of
the week days. The calendar should have also shown

that user is available
from Monday to Friday in evening slot.
I also tried with the simple way as below but the

results being different
and not as expected as mentioned.
Union:
     Intersection:

  MinuteRange(0, 0)
 HourRange(08, 08) // Starts at 0800hr
 DayOfWeekRange(Saturday, Sunday) // Saturday and
Sunday

user
is available in morning slot.

 Intersection:
     MinuteRange(0, 0)
     HourRange(12, 12) // Starts at 1200hr
     DayOfWeekRange(Saturday, Sunday) //
Saturday and Sunday

user is available in afternoon slot.
 Intersection:
     MinuteRange(0, 0)
     HourRange(16, 16) // Starts at 1600hr
     DayOfWeekRange(Monday, Friday)  //
Monday thru Friday

user is available in evening slot.

In XML the data is below (using the first

approach)
  <!-- Entire week morning available
-->
  <TemporalExpression
tempExprId="MORNING_AVAIL"
tempExprTypeId="INTERSECTION"/>
  <TemporalExpressionAssoc

fromTempExprId="MORNING_AVAIL"
toTempExprId="HOUR_08"/>
  <TemporalExpressionAssoc

fromTempExprId="MORNING_AVAIL"
toTempExprId="MINUTE_00"/>
  <TemporalExpressionAssoc

fromTempExprId="MORNING_AVAIL"
toTempExprId="SAT_TO_SUN"/>
  <!-- Days when not available in

morning -->
  <TemporalExpression
tempExprId="MORNING_UNAVAIL"
tempExprTypeId="INTERSECTION"/>
  <TemporalExpressionAssoc

fromTempExprId="MORNING_UNAVAIL"
toTempExprId="DAYOFWEEK_02"/>
  <TemporalExpressionAssoc

fromTempExprId="MORNING_UNAVAIL"
toTempExprId="DAYOFWEEK_03"/>
  <TemporalExpressionAssoc

fromTempExprId="MORNING_UNAVAIL"
toTempExprId="DAYOFWEEK_04"/>
  <TemporalExpressionAssoc

fromTempExprId="MORNING_UNAVAIL"
toTempExprId="DAYOFWEEK_05"/>
  <TemporalExpressionAssoc

fromTempExprId="MORNING_UNAVAIL"
toTempExprId="DAYOFWEEK_06"/>
 <!-- Entire week morning

conflicts will determine the days when a user
is
available or not -->
  <TemporalExpression

tempExprId="MORNING_CONFLICTS"
tempExprTypeId="DIFFERENCE"/>
  <TemporalExpressionAssoc

fromTempExprId="MORNING_CONFLICTS"
toTempExprId="MORNING_AVAIL"
exprAssocType="INCLUDE"/>
  <TemporalExpressionAssoc
fromTempExprId="MORNING_CONFLICTS"
toTempExprId="MORNING_UNAVAIL"
exprAssocType="EXCLUDE"/>
  <!-- Afternoon -->
  <TemporalExpression

tempExprId="AFTERNOON_AVAIL"
tempExprTypeId="INTERSECTION"/>
  <TemporalExpressionAssoc

fromTempExprId="AFTERNOON_AVAIL"
toTempExprId="HOUR_12"/>
  <TemporalExpressionAssoc

fromTempExprId="AFTERNOON_AVAIL"
toTempExprId="MINUTE_00"/>
  <TemporalExpressionAssoc

fromTempExprId="AFTERNOON_AVAIL"
toTempExprId="SAT_TO_SUN"/>
  <TemporalExpression

tempExprId="AFTERNOON_UNAVAIL"
tempExprTypeId="INTERSECTION"/>
  <TemporalExpressionAssoc

fromTempExprId="AFTERNOON_UNAVAIL"
toTempExprId="DAYOFWEEK_02"/>
  <TemporalExpressionAssoc

fromTempExprId="AFTERNOON_UNAVAIL"
toTempExprId="DAYOFWEEK_03"/>
  <TemporalExpressionAssoc

fromTempExprId="AFTERNOON_UNAVAIL"
toTempExprId="DAYOFWEEK_04"/>
  <TemporalExpressionAssoc

fromTempExprId="AFTERNOON_UNAVAIL"
toTempExprId="DAYOFWEEK_05"/>
  <TemporalExpressionAssoc

fromTempExprId="AFTERNOON_UNAVAIL"
toTempExprId="DAYOFWEEK_06"/>
  <TemporalExpression

tempExprId="AFTERNOON_CONFLICTS"
tempExprTypeId="DIFFERENCE"/>
  <TemporalExpressionAssoc

fromTempExprId="AFTERNOON_CONFLICTS"
toTempExprId="AFTERNOON_AVAIL"
exprAssocType="INCLUDE"/>
  <TemporalExpressionAssoc
fromTempExprId="AFTERNOON_CONFLICTS"
toTempExprId="AFTERNOON_UNAVAIL"
exprAssocType="EXCLUDE"/>
  <!-- Evening -->
  <TemporalExpression

tempExprId="EVENING_AVAIL"
tempExprTypeId="INTERSECTION"/>
  <TemporalExpressionAssoc

fromTempExprId="EVENING_AVAIL"
toTempExprId="HOUR_16"/>
  <TemporalExpressionAssoc

fromTempExprId="EVENING_AVAIL"
toTempExprId="MINUTE_00"/>
  <TemporalExpressionAssoc

fromTempExprId="EVENING_AVAIL"
toTempExprId="SAT_TO_SUN"/>
  <TemporalExpression

tempExprId="EVENING_UNAVAIL"
tempExprTypeId="INTERSECTION"/>
  <TemporalExpressionAssoc

fromTempExprId="EVENING_UNAVAIL"
toTempExprId="DAYOFWEEK_01"/>
  <TemporalExpressionAssoc

fromTempExprId="EVENING_UNAVAIL"
toTempExprId="DAYOFWEEK_07"/>
  <TemporalExpression

tempExprId="EVENING_CONFLICTS"
tempExprTypeId="DIFFERENCE"/>
  <TemporalExpressionAssoc

fromTempExprId="EVENING_CONFLICTS"
toTempExprId="EVENING_AVAIL"
exprAssocType="INCLUDE"/>
  <TemporalExpressionAssoc
fromTempExprId="EVENING_CONFLICTS"
toTempExprId="EVENING_UNAVAIL"
exprAssocType="EXCLUDE"/>
  <!-- Week Conflicts -->
  <TemporalExpression

tempExprId="WEEK_CONFLICTS"
tempExprTypeId="UNION"/>
  <TemporalExpressionAssoc

fromTempExprId="WEEK_CONFLICTS"
toTempExprId="MORNING_CONFLICTS"/>
  <TemporalExpressionAssoc

fromTempExprId="WEEK_CONFLICTS"
toTempExprId="AFTERNOON_CONFLICTS"/>
  <TemporalExpressionAssoc

fromTempExprId="WEEK_CONFLICTS"
toTempExprId="EVENING_CONFLICTS"/>
  <WorkEffort

workEffortId="DEMO_CUSTOMER_CONF" workEffortTypeId="EVENT"
currentStatusId="CAL_CONFIRMED"
lastStatusUpdate="2010-04-16 16:21:58.619"
scopeEnumId="WES_PUBLIC" workEffortName="Week
Conflicts"
sendNotificationEmail="Y"
estimatedStartDate="2010-01-01 08:00:10.274"
tempExprId="WEEK_CONFLICTS" revisionNumber="1"
createdDate="2010-04-16
16:21:58.619" createdByUserLogin="admin"/>
  <WorkEffortPartyAssignment

workEffortId="DEMO_CUSTOMER_CONF"
partyId="DemoCustomer" roleTypeId="CAL_OWNER"
fromDate="2010-04-16
16:21:58.812" statusId="PRTYASGN_ASSIGNED"/>
I have no idea where I am doing it wrong since

second approach is a very
simple (at least I was expecting correct result
with it).
Does anyone have ever setup similar rules based on
temporal expressions?
OR
I am just struggling with any sort of bugs?

Any help would be much appreciated.

Regards
Vikas






Reply via email to