I've got a Drupal 8 site, and I've created content types and a view for scheduling. For an easy example, we'll say it's a softball league, and the content type/view allows me to put in that on August 21 is the Giants vs. the Bombers, August 25 is the Rockets vs. the T-Birds, etc. So each game has the teams and date. I have then broken it down into two views, the first creates a, "Next Game" block, and the other creates a "Upcoming Games" block (Both reading from the same data). I've figured out how to get the "Upcoming Games" block to skip the first, so that the "Next game" doesn't show up on both blocks.

So far, so good. I input the games as they are set up, and they show fine. For example, as I write this, it is August 18th. Let's say that I sit down, and I input 8 different games. So, the August 18th game shows under "Next Game", and then the games for the 19th, 20th, 25th, 27th and 30th, come up under "Upcoming Games". So far, so good. However, when it passes Midnight, and it is now the 20th, since I just have the views looking at things in order, it still has the game from the 18th showing under "Next game", until I manually go into Content and delete or disable the entry for the 18th.

Being a computerized system, I'm sure there has to be a way that I can have it check the current date, and basically tell the views to ignore any entries prior to the current date, so that the "Next Game" block will always show the next upcoming game. but I haven't yet figure out how to do that. IDEALLY, since the games are all at 7:00pm, If someone views the site at 6:59pm, it would show tonight's game under "Next Game", and if they view the site at 7:00pm, it would show tomorrow's game under "Next Game", as tonight's game is already underway.

I'm not sure how to go about making this happen. Any help is appreciated.

Comments

pixelsweatshop’s picture

In your view filters add you date field, choose realtime date and enter "greater than now"

BEGRAFX’s picture

Is that in Drupal 8 or Drupal 7? I'm using Drupal 8, and I've looked through the filters, and I'm not finding the choices you mention.

pixelsweatshop’s picture

It works the same for both versions. See screenshot https://i.stack.imgur.com/y46V2.png

BEGRAFX’s picture

I tried this, and it doesn't seem to be working. Is the "Date (field_date)" the wrong field? I've added the filter to both "This Week's Game" and "Upcoming Games" views, and though it is 8/26/2017, it still shows the game from 8/19 in "This Week's Game", and the games for 8/26 and onward under "upcoming games".

BEGRAFX’s picture

OK, I got side-tracked on another project for a bit, but I'm back on this one, and I've now managed to get the same screen that you show. I have "Operator" set to "Is Greater Than", "Value Type" is set to "A date in any machine readable format..." and Value is set to "NOW", yet as I write this (on Monday, October 18th), when I save and view, what shows is the event for Saturday, the 14th, rather than the one for the 21st.

screenshot

pixelsweatshop’s picture

Post a screenshot of your filter settings for that field.

BEGRAFX’s picture

Ok, here is... uh... wait... it appears they have changed things here. I'm not seeing an option to add images/screenshots/etc. like we used to be able to do. I see the "Insert/edit image" button on the toolbar, but when I click it, it asks for a URL. Do I now have to upload the image elsewhere, and just link to it?

pixelsweatshop’s picture

For some reason they only allow images to be uploaded in the issue queues and not forums. You will need to upload it to an image hosting site and link back.

BEGRAFX’s picture

Ok, I got it figured out and working, however, I have an issue still. It will show the next game as being on the 1st, which is correct. However, while I would expect it to show the game for the 1st til the 2nd (if date is greater than now, then if the date is the 1st and the game date is the 1st it should show the game of the 1st until 12:00am on the 2nd, and then show the game for the 7th, however, for some reason it shows the game for the 1st, but at some point on the 30th (or 31st as may be the case ) it will switch to show the game for the 7th. I have checked, the default time zone is set correctly. 

IDEALLY,  I would like to have it show the game for the 1st until 6:00pm on the 1st, when that game starts, and THEN show the game for the 7th. Is that possible?

Also, how do I get it to review the games list again and show the next game correctly? What I mean is, if I have the game for the 1st and the game for the 7th on the list, and then, on the 3rd, I add a game on the 5th, when it is already showing the 7th as the next game, it seems to stick on the game for the 7th as the next game, though it isn't. I have tried clearing the cache, I have gone in and clicked "update preview" on the view, nothing seems to make it see the game for the 5th. 

Thank you for your help.

BEGRAFX’s picture

OK, so I had it all figured out and it was working... keyword "WAS". All of a sudden, it gets to where it will show a date, and STICK, and I have to go in and clear the caches in order to get it to progress. Once I do, it will work fine for a time, and then starts doing this again. I'm not sure how to proceed. I'm sure there has to be a better way than manually clearing the caches each week. The other oddity I'm finding is, when it DOES work, it seems to progress at odd times.What I mean by that is, it is set up to show the weekly games, which are each Sunday at Noon. What I wanted, was for the view to update each Sunday at noon... so, for example, for this week, the View would show the game for Sunday the 4th, and then at Noon on the 4th, as that game started, the view would update, and show the game for the 11th, and then at noon on the 11th, it would update again and show the game for the 18th, and so on...

That's how I INTENDED it to work. But, for some weird reason, one week I'll look at it like 7:30pm (Eastern) on Saturday, and I'll find that it has ALREADY updated, so it isn't showing me the next day's game, but the game for the following week. Yes, it IS showing dates, so I can see that it is the game for the week ahead, but... then another week, I'll look at it at 10:00am Sunday, and it still shows that day's game, but when I look again around 11:30, it has updated... and then, of course, as mentioned above, there are the times where Noon Sunday comes and goes, and when I look at it Monday morning, it still shows the game from the previous day, and I have to flush the caches to get it to update.

My intent was to do an updated version of this, using the full date and time, and I'd have a "Next Game" view and an, "Upcoming Games" view, with the intent that, if there were 3 games on a Sunday, lets say Noon, 3:00 and 6:00, as well as next weeks game(s), I could look at the site at 10am Sunday, and I could see, "Next Game: is the Twins vs the Bandits at 12:00 noon on Field 3" and upcoming games would show "Diggers vs Knights" and the date and time, but then at noon, as the Twins/Bandits game starts, the site would update and show the "Diggers/Knights" as Next game, showing additional information... so basically you would get full information on the "next game" and have a list of the next 5 games after that showing more abbreviated information... But I have to get past the "clearing the cache" issue first.

pixelsweatshop’s picture

At this point I have no idea what is going on with your issue. Without seeing your setup directly form the backend, it would be next to impossible for me to speculate what the problem is. My only thought is that your caching the pages and not running cron properly on a regular basis. Try turning off the caching for that page or schedule runing cron more often.