Latest Posts

Topic: Forum navigation back arrow

kaputtnik
Avatar
Joined: 2013-02-18, 20:48
Posts: 2433
OS: Archlinux
Version: current master
Ranking
One Elder of Players
Location: Germany
Posted at: 2015-06-06, 16:19

einstein13 wrote:

I have tried to track it down in this widelands-site part, but I've failed to understand that.

http://bazaar.launchpad.net/~widelands-dev/widelands-website/trunk/view/head:/pybb/unread.py

(where is it used?)

You have pointed here out one problem of the website code: This function is never used and it is currently absolute useless. It allways returns the variable "qs" which is the first parameter of the function. The complete website code has lots of those unused functions and most functions aren't documented well and are therefore difficult to read. So many time get's lost by trying to understand a function (which name sounds very interesting) and in the end you have to consider, that this function is useless face-upset.png

timestamp is for sure most important: newer posts than "last_visit" timestamp are for sure unread.

May i got another way to get the last_login timestamp: The user model has a field "last_login" but the value for that is unfortunally updated to "now" if a user loggs in. See django last_login. It should be possible to store the value of "last_login" to a session cookie before this value is updated to "now". After doing so, we have the latest login time stored. But of course this timestamp is vague, because it covers only the begin of the last session and the user has read some posts between login and log out.

But I think that current model of Forum & User is enough to list all unread posts. One clever query to database face-smile.png

You could try yourself for doing this face-smile.png


Fight simulator for Widelands:
https://wide-fighter.netlify.app/

Top Quote
DragonAtma
Avatar
Joined: 2014-09-14, 01:54
Posts: 351
Ranking
Tribe Member
Posted at: 2015-06-06, 19:07

Hmm...

What if you had a button ("Session finished") whose sole purpose was to notify the site of the time when the button is clicked? Then, assuming people only click the button when they're done, it'll work for a "new posts since last logout" list without people having to actually log out.


Top Quote
wl-zocker

Joined: 2011-12-30, 17:37
Posts: 495
Ranking
Tribe Member
Location: Germany
Posted at: 2015-06-06, 19:26

Just a question: What happens if I do not log out, but simply close all widelands tabs? When I come back to the website (even after switching off my computer), I do not (have to) log in anew.

I am not sure if a button "Session finished" would be better than what we currently have. Everyone would have to remember to push it before leaving.

Would it be possible to get the time period a user in accessing the website by the timestamps of when he clicks somewhere (links to threads etc.)? Or could you do something with page loading (whenever a new page is loaded this time is the last access)?


"Only few people know how much one has to know in order to know how little one knows." - Werner Heisenberg

Top Quote
GunChleoc
Avatar
Joined: 2013-10-07, 15:56
Posts: 3324
Ranking
One Elder of Players
Location: RenderedRect
Posted at: 2015-06-07, 11:04

I agree with wl-zocker's concerns. Both proposed solutions are not viable.

Whenever the user clicks on something, a new page is requested. When the request is processed, there must also be a check somewhere if the user is logged in, and then the unread threads/forums are already being marked by the software. This is the point to hook into to set a timestamp in the userdata in the database. Again, I am wondering how the forum software does this now - how does it know which forums and threads I have read? How does it update the info when I am reading a thread, because the "new" marker does disappear then? The forum might already have some of the knowledge needed for this.

phpBB has 2 database fields / cookies to keep track for unread posts:

  1. New posts since last visit, this uses a timestamp compare
  2. Posts that were unread during the last visit and haven't been read yet. This uses a comma-separated list of post IDs that is stored in a single field

For logged in users, this is done via the database, and for guests this is done via a cookie.


Busy indexing nil values

Top Quote
kaputtnik
Avatar
Joined: 2013-02-18, 20:48
Posts: 2433
OS: Archlinux
Version: current master
Ranking
One Elder of Players
Location: Germany
Posted at: 2015-06-07, 12:06

You could find the relevant code in:

There is also a app called "tracking" which stores some user information: https://pypi.python.org/pypi/django-tracking/0.4.1


You should have to know that our website uses currently django version 1.3.7 which is deprecated (current official version of django is 1.8). Thats why i do currently not want to make heavy changes to the website... i fear that the more is changed, the difficult would be an update to a later version of django. There are plans to update the django version, but because of different reasons, it hasn't be done and i believe that it will take some more time...


Fight simulator for Widelands:
https://wide-fighter.netlify.app/

Top Quote
einstein13
Avatar
Joined: 2013-07-29, 00:01
Posts: 1118
Ranking
One Elder of Players
Location: Poland
Posted at: 2015-06-08, 15:45

kaputtnik wrote:

You should have to know that our website uses currently django version 1.3.7 which is deprecated (current official version of django is 1.8). Thats why i do currently not want to make heavy changes to the website... i fear that the more is changed, the difficult would be an update to a later version of django. There are plans to update the django version, but because of different reasons, it hasn't be done and i believe that it will take some more time...

At my work we use django 1.6 and there are major problems to update that. Most of them are about related packages face-wink.png Some about syntax, but not so much face-smile.png


einstein13
calculations & maps packages: http://wuatek.no-ip.org/~rak/widelands/
backup website files: http://kartezjusz.ddns.net/upload/widelands/

Top Quote