From: Shana R. <sha...@gm...> - 2010-10-18 21:24:58
|
The second ask query is what is getting the recurring events. It basically is the original query I had started with. It is definitely working! That second display template that it uses does not have the #ifeq . I do worry about multiple ask queries re: performance. But I just can't figure out any way to query all the recurring and non-recurring events that fall within the 24 hour period. If something pops into my head (or someone has a suggestion) I'll change it but for now I'll go with what works. Shana On Mon, Oct 18, 2010 at 4:56 PM, Stephan Gambke <f....@gm...> wrote: > This is a solution, too. The problem is, that it always gets a lengthy > list of each and every recurring event and sorts them out afterwards. I > do not know if there is a performance punishment for that. If your wiki > is small enough it probably does not matter. > > I think you should remove the second ask from your code, though. It will > never return anything, because it does not give a second parameter to > the template which means the ifeq can never resolve to true. > > > Am 18.10.2010 22:36, schrieb Shana Rosenberg: > > Got it working! TOTAL hack...completely...but hey, if it's working then > > I'm fine with it. And it gives me some ideas on how to deal with my > > future problem of displaying businesses open at the current time. This > > exercise has led me to wish that the separate dates of recurring events > > could be used in queries (or I wouldn't have had to hack as I ended up > > doing). Perhaps I'm missing something that could be done with #arraymap > > . I'll have to think about it. > > > > Thanks Stephan, your explanation of where my understanding was incorrect > > led me to the answer. > > > > So I put in two separate queries, using two separate display templates, > > one right after the other. Then I used #ifeq from > > Extension:ParserFunctions in the display template dealing with single > > time events. > > > > {{#ask: [[Category:Bar and Restaurant Events and Specials]][[event > > date::>{{CURRENTYEAR}}-{{CURRENTMONTH}}-{{CURRENTDAY}} 00:00:00]][[event > > date::<{{CURRENTYEAR}}-{{CURRENTMONTH}}-{{CURRENTDAY}} 23:59:59]] > > | ?event date > > | format=template > > |template=Display Today Event > > |link=none > > }}{{#ask: [[Category:Bar and Restaurant Events and Specials]][[event > > date::{{CURRENTYEAR}}-{{CURRENTMONTH}}-{{CURRENTDAY}} 00:00:00]] > > | format=template > > |template=Display Today Repeating Event > > |link=none > > }} > > > > And then I put a conditional parser statement into the template showing > > today's (single time) events: > > > > {{#ifeq: {{#time: Y-m-j|{{{2}}}}} | > > {{CURRENTYEAR}}-{{CURRENTMONTH}}-{{CURRENTDAY}}|*[[{{{1}}} | <span > > style="font-size:90%">'''{{#show: {{{1}}}|?venue#}} - {{#show: > > {{{1}}}|?event title#}}'''</span>]]|}} > > > > Another problem solved :) (unless someone has a better way to deal with > > this). On to the next! > > > > Shana > > > > On Mon, Oct 18, 2010 at 2:30 PM, Stephan Gambke <f....@gm... > > <mailto:f....@gm...>> wrote: > > > > > > Am 18.10.2010 19:41, schrieb Shana Rosenberg: > > > {{CURRENTDAY}} is actually the number of the date in the month > (e.g. > > > today is 18), so really your original code (and my original code) > > should > > > work. Both pieces really are asking the same thing as far as the > > date of > > > the event. Time SHOULDN'T be a limiting factor because the date > (year, > > > month, day) is the same regardless of time. > > > > No, it is not. As I said, there is no such thing as a date without > time. > > If you ask for [[event date::2010-10-18]] this is always interpreted > as > > [[event date::2010-10-18 00:00:00]]. This means as soon as you add a > > time to your event date asking for [[event date::2010-10-18]] will > not > > work as you expect anymore. > > > > > And in fact, your code is producing results not just from all the > > > Mondays, but from ALL the days (though interestingly, it is only > > showing > > > recurring events in the list once instead of all of them). > > > > I explained that. If an event has two (or more) dates, then it will > > always match my query. > > > > Look at this event: > > > http://theoxfordunderground.com/index.php/Special:Browse/45_East_Bar_and_Grill-2FEvents_and_Specials-2FCountry_Night_with_DJ_Mike > > > > Obviously it occured before today 23:59. As obviously it will occur > > after today 0:00. The AND-condition is fulfilled. > > > > > > > My code is > > > producing all the recurring events (in which I do not specify times > > > except as part of the regular event text field), and also single > time > > > events without times, but for the correct day (today) only. It is > not > > > displaying single-time events with times specified (undesirable). > > > > Yes. See above: Without a time the event defaults to 00:00. Asking > > without a time defaults to 00:00, too. Hence asking without a time > gives > > you all the events where no time has been specified. > > > > > > > I have no idea....I really think either of our pieces of code > should > > > work. > > > > I really think neither of our pieces of code should work. ;-) > > > > Or rather your code should work if you would not store times with > > the dates. > > > > > > > The problem is simply the time thing, and although I agree that a > > > hack that would probably work is to just have the time in a > separate > > > field, a future feature for the wiki that I wish to implement needs > to > > > have this working "properly". (I'm going to have, I hope, the > display > > > for a business show, on viewing the page for that business, > > whether the > > > place is currently open or not). This requires that time be treated > as > > > time, not as a string value. > > > > Lets solve one problem at a time. > > > > > > > > > Frustrated. > > > > > > Shana > > > > > > On Mon, Oct 18, 2010 at 1:07 PM, Stephan Gambke <f....@gm... > > <mailto:f....@gm...> > > > <mailto:f....@gm... <mailto:f....@gm...>>> wrote: > > > > > > I think the problem is the way recurring events are stored - > > all with > > > the same property. So if we had some event that occured last > > sunday and > > > it is to again occur next sunday, then > > > [[event date::<{{CURRENTYEAR}}-{{CURRENTMONTH}}-{{CURRENTDAY}} > > > 23:59:59]] > > > would be true because last sunday matches and > > > [[event > date::>{{CURRENTYEAR}}-{{CURRENTMONTH}}-{{CURRENTDAY}}]] > > > would also be true because next sunday matches. > > > > > > There are probably several solutions that would work, but I > > think it > > > would be best if you just separated the date and the time of > > the event, > > > i.e. record the time in a dedicated property "event time". > > Then your > > > original ask-query should work. > > > > > > > > > > > > Am 18.10.2010 17:46, schrieb Shana Rosenberg: > > > > Hi Stephan, thanks, and I agree with you that your code > > should work. > > > > > > > > But it doesn't! I tried specifying 00:00:00 for the > > > date/time . I > > > > tried leaving the first event date condition as an equal > > operator > > > only. > > > > I tried specifying the first event date condition as having > the > > > time of > > > > 00:00:00 . The results from these experiments showed me that > > basically > > > > the query is not ANDing the event date conditions. > > > > > > > > > > > > > > http://theoxfordunderground.com/index.php/User:Theoxundrgrnd/sandbox/bar > > > is > > > > the link to the results (left-most box in the article) > > produced by > > > your > > > > code that seems to me to make perfect sense. > > > > > > > > Any ideas? > > > > > > > > Shana > > > > > > > > On Mon, Oct 18, 2010 at 10:34 AM, Stephan Gambke > > <f....@gm... <mailto:f....@gm...> > > > <mailto:f....@gm... <mailto:f....@gm...>> > > > > <mailto:f....@gm... <mailto:f....@gm...> > > <mailto:f....@gm... <mailto:f....@gm...>>>> wrote: > > > > > > > > Haven't tested it, but something like this should do: > > > > > > > > {{#ask: [[Category:Bar and Restaurant Events and > > Specials]][[event > > > > > > date::>{{CURRENTYEAR}}-{{CURRENTMONTH}}-{{CURRENTDAY}}]][[event > > > > date::<{{CURRENTYEAR}}-{{CURRENTMONTH}}-{{CURRENTDAY}} > > 23:59:59]] > > > > | format=template > > > > |template=Display Today Event > > > > |link=none > > > > }} > > > > > > > > Two remarks: > > > > - AFAIK every date is internally stored as a DATETIME. > > If you > > > set or > > > > query a date without a time component it is stored as > > that date > > > > 00:00:00. > > > > - The > and < operands are actually treated by SMW as >= > > and <= > > > > operands. > > > > > > > > Stephan > > > > > > > > Am 18.10.2010 15:11, schrieb Shana Rosenberg: > > > > > My event calendar for bars and restaurants now works > > great. > > > > However, I am > > > > > trying to make the event portal more dynamic and user > > > friendly so I am > > > > > adding a "todays events" box. Recurring events show up > > just fine > > > > in this > > > > > box, but single time events --*only when a time is > > specified -- > > > > *do not show > > > > > up using my query: > > > > > > > > > > {{#ask: [[Category:Bar and Restaurant Events and > > > Specials]][[event > > > > > date::{{CURRENTYEAR}}-{{CURRENTMONTH}}-{{CURRENTDAY}}]] > > > > > | format=template > > > > > |template=Display Today Event > > > > > |link=none > > > > > }} > > > > > > > > > > I tested several things before coming to the > > conclusion that > > > time > > > > is the > > > > > factor affecting query results not including events > that > > > have a time > > > > > specified. This includes: it is not the display > > template, it > > > is not a > > > > > variation in property names in any of the pages using > > event > > > > properties. > > > > > > > > > > Any ideas or further information you would need to > help? > > > > > > > > > > Thanks, > > > > > Shana > |