Consider I have a Task class like this :
class Task {
String title
Date assignedOn
User user
}
Now the user can have many tasks. Now consider there are 8 tasks already assigned to userX. Now the manager(a special kind of user) is creating a 2 tasks to that userX, now I have totally 10 tasks of the userX. It is easy to display all the 10 tasks to that user.
But what I want is, I need a way to display only those 2 tasks to that userX assuming that the userX have already viewed those 8 tasks.
A real world example would be Stackoverflow site itself. If the person is answering my question I get a notification stating 1 new answer on the q..... and I will view it. After some time, if any one answers my same question, I get a notification stating 1 new answer not 2 new answer as I have already viewed the first answer.
What are the ways I can use to do this? Any plugins available for this in grails?
Thanks in advance.
In principle, i would add a boolean flag on the Task class to indicate if it has been viewed or not by the user like so:
When creating a task the
viewStatusflag would be set to false. Whenever the user views a particular task theviewStatusflag would be set by your program to true. It is therefore possible to query for just the un-read tasks to display to your user (using GORM) like so:The query will return only any user tasks that have not been read by the user, assuming that the readStatus is properly set whenever a user reads a task.