Reading History Management

By default, our user management system manages reading records according to the __readingHistoryTable__ . You can refer to the following SQL statement to create ** __readingHistoryTable__**.

CREATE __readingHistoryTable__
1
2
3
4
5
6
CREATE TABLE IF NOT EXISTS __readingHistoryTable__ (
  reportName TEXT NOT NULL,
  username TEXT NOT NULL,
  lastReadingTime DATETIME  DEFAULT (DATETIME('now', 'localtime')) NOT NULL,
  readingCount INT DEFAULT 1 NOT NULL
);

In ** __readingHistoryTable__**, you need to create at least the following columns: reportName, username, lastReadingTime, readingCount, other columns can be created or deleted according to actual needs.


rreportName is the report name you defined in the report management system.

username is the user name you defined in the User Management System (/maintenance/UserManagement/).

lastReadingTime is the last time the user reads the report.

readingCount is the total number of times users read the report.

At the same time, you need to add a lastModifyTime column to __reportTable__ .

ALTER __reportTable__
1
2
ALTER TABLE __reportTable__ 
    ADD COLUMN lastModifyTime DATETIME  DEFAULT (DATETIME('now', 'localtime')) NOT NULL,

User’s reading progress will be defined according to the lastModifyTime column in __reportTable__ and the lastReadingTime column in __readingHistoryTable__ . If lastReadingTime is later than lastModifyTime then read , less than updated , and if lastReadingTime is NULL then unread .

Data in __readingHistoryTable__ will automatically updated according to users’ actual reading situation. You just need to modify the lastModifyTime column of **__ reportTable__ ** when you create or modify a report.