Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions SQL/0000-00-00-schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2510,7 +2510,7 @@ CREATE TABLE `publication_users_edit_perm_rel` (
CONSTRAINT `FK_publication_users_edit_perm_rel_UserID` FOREIGN KEY (`UserID`) REFERENCES `users` (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET='utf8';

CREATE TABLE login_summary_statistics (
CREATE TABLE Login_Summary_Statistics (
Title VARCHAR(255),
Project VARCHAR(255),
Value INT,
Expand Down Expand Up @@ -2646,4 +2646,4 @@ CREATE TABLE `redcap_notification` (
`handled_dt` datetime NULL,
PRIMARY KEY (`id`),
KEY `i_redcap_notif_received_dt` (`received_dt`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2 changes: 1 addition & 1 deletion SQL/9999-99-99-drop_tables.sql
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ DROP TABLE IF EXISTS `publication`;
DROP TABLE IF EXISTS `publication_status`;
DROP TABLE IF EXISTS `publication_collaborator`;

DROP TABLE IF EXISTS `login_summary_statistics`;
DROP TABLE IF EXISTS `Login_Summary_Statistics`;

DROP TABLE IF EXISTS `parameter_session`;
DROP TABLE IF EXISTS `parameter_file`;
Expand Down
2 changes: 1 addition & 1 deletion SQL/Archive/27.0/2024-12-18-Login-Statistics.sql
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ ALTER TABLE dataquery_study_queries_rel
MODIFY COLUMN PinType enum('topquery','dashboard', 'loginpage') DEFAULT NULL;

ALTER TABLE Project
ADD COLUMN showSummaryOnLogin BOOLEAN DEFAULT TRUE;
ADD COLUMN showSummaryOnLogin BOOLEAN DEFAULT TRUE;
4 changes: 3 additions & 1 deletion SQL/Release_patches/26.0_To_27.0_upgrade.sql
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,9 @@ INSERT INTO ConfigSettings (Name, Description, Visible, AllowMultiple, DataType,
COALESCE(MAX(child_config.OrderNumber), 0) +1
FROM ConfigSettings parent_config
LEFT JOIN ConfigSettings child_config ON (parent_config.ID = child_config.Parent)
WHERE parent_config.Name = 'redcap';CREATE TABLE Login_Summary_Statistics (
WHERE parent_config.Name = 'redcap';

CREATE TABLE Login_Summary_Statistics (
Title VARCHAR(255),
Project VARCHAR(255),
Value INT,
Expand Down
4 changes: 2 additions & 2 deletions modules/login/php/summary_statistics.class.inc
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class Summary_Statistics extends \NDB_Page implements ETagCalculator
case 'GET':
$DB = $this->loris->getDatabaseConnection();
$response = $DB->pselect(
"SELECT * FROM login_summary_statistics
"SELECT * FROM Login_Summary_Statistics
WHERE Value > 0
ORDER BY QueryOrder ASC",
[],
Expand All @@ -40,7 +40,7 @@ class Summary_Statistics extends \NDB_Page implements ETagCalculator
return new \LORIS\Http\Response\JsonResponse(null);
}
$projects = $DB->pselectCol(
"SELECT DISTINCT Project FROM login_summary_statistics",
"SELECT DISTINCT Project FROM Login_Summary_Statistics",
[]
);

Expand Down
56 changes: 28 additions & 28 deletions raisinbread/RB_files/RB_login_summary_statistics.sql
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
SET FOREIGN_KEY_CHECKS=0;
TRUNCATE TABLE `login_summary_statistics`;
LOCK TABLES `login_summary_statistics` WRITE;
INSERT INTO `login_summary_statistics` (`Title`, `Project`, `Value`, `QueryOrder`) VALUES ('EEG Recording','All Projects',10,7);
INSERT INTO `login_summary_statistics` (`Title`, `Project`, `Value`, `QueryOrder`) VALUES ('EEG Recording','Pumpernickel',10,7);
INSERT INTO `login_summary_statistics` (`Title`, `Project`, `Value`, `QueryOrder`) VALUES ('Female Participant','All Projects',334,1);
INSERT INTO `login_summary_statistics` (`Title`, `Project`, `Value`, `QueryOrder`) VALUES ('Female Participant','Challah',47,1);
INSERT INTO `login_summary_statistics` (`Title`, `Project`, `Value`, `QueryOrder`) VALUES ('Female Participant','Pumpernickel',225,1);
INSERT INTO `login_summary_statistics` (`Title`, `Project`, `Value`, `QueryOrder`) VALUES ('Female Participant','Rye',62,1);
INSERT INTO `login_summary_statistics` (`Title`, `Project`, `Value`, `QueryOrder`) VALUES ('Instrument','All Projects',5,5);
INSERT INTO `login_summary_statistics` (`Title`, `Project`, `Value`, `QueryOrder`) VALUES ('Instrument','Challah',5,5);
INSERT INTO `login_summary_statistics` (`Title`, `Project`, `Value`, `QueryOrder`) VALUES ('Instrument','Pumpernickel',5,5);
INSERT INTO `login_summary_statistics` (`Title`, `Project`, `Value`, `QueryOrder`) VALUES ('Instrument','Rye',2,5);
INSERT INTO `login_summary_statistics` (`Title`, `Project`, `Value`, `QueryOrder`) VALUES ('Male Participant','All Projects',328,2);
INSERT INTO `login_summary_statistics` (`Title`, `Project`, `Value`, `QueryOrder`) VALUES ('Male Participant','Challah',60,2);
INSERT INTO `login_summary_statistics` (`Title`, `Project`, `Value`, `QueryOrder`) VALUES ('Male Participant','Pumpernickel',210,2);
INSERT INTO `login_summary_statistics` (`Title`, `Project`, `Value`, `QueryOrder`) VALUES ('Male Participant','Rye',58,2);
INSERT INTO `login_summary_statistics` (`Title`, `Project`, `Value`, `QueryOrder`) VALUES ('Scan','All Projects',311,6);
INSERT INTO `login_summary_statistics` (`Title`, `Project`, `Value`, `QueryOrder`) VALUES ('Scan','Challah',23,6);
INSERT INTO `login_summary_statistics` (`Title`, `Project`, `Value`, `QueryOrder`) VALUES ('Scan','Pumpernickel',247,6);
INSERT INTO `login_summary_statistics` (`Title`, `Project`, `Value`, `QueryOrder`) VALUES ('Scan','Rye',41,6);
INSERT INTO `login_summary_statistics` (`Title`, `Project`, `Value`, `QueryOrder`) VALUES ('Site','All Projects',4,3);
INSERT INTO `login_summary_statistics` (`Title`, `Project`, `Value`, `QueryOrder`) VALUES ('Site','Challah',1,3);
INSERT INTO `login_summary_statistics` (`Title`, `Project`, `Value`, `QueryOrder`) VALUES ('Site','Pumpernickel',4,3);
INSERT INTO `login_summary_statistics` (`Title`, `Project`, `Value`, `QueryOrder`) VALUES ('Site','Rye',1,3);
INSERT INTO `login_summary_statistics` (`Title`, `Project`, `Value`, `QueryOrder`) VALUES ('Visit','All Projects',1133,4);
INSERT INTO `login_summary_statistics` (`Title`, `Project`, `Value`, `QueryOrder`) VALUES ('Visit','Challah',147,4);
INSERT INTO `login_summary_statistics` (`Title`, `Project`, `Value`, `QueryOrder`) VALUES ('Visit','Pumpernickel',855,4);
INSERT INTO `login_summary_statistics` (`Title`, `Project`, `Value`, `QueryOrder`) VALUES ('Visit','Rye',131,4);
TRUNCATE TABLE `Login_Summary_Statistics`;
LOCK TABLES `Login_Summary_Statistics` WRITE;
INSERT INTO `Login_Summary_Statistics` (`Title`, `Project`, `Value`, `QueryOrder`) VALUES ('EEG Recording','All Projects',10,7);
INSERT INTO `Login_Summary_Statistics` (`Title`, `Project`, `Value`, `QueryOrder`) VALUES ('EEG Recording','Pumpernickel',10,7);
INSERT INTO `Login_Summary_Statistics` (`Title`, `Project`, `Value`, `QueryOrder`) VALUES ('Female Participant','All Projects',334,1);
INSERT INTO `Login_Summary_Statistics` (`Title`, `Project`, `Value`, `QueryOrder`) VALUES ('Female Participant','Challah',47,1);
INSERT INTO `Login_Summary_Statistics` (`Title`, `Project`, `Value`, `QueryOrder`) VALUES ('Female Participant','Pumpernickel',225,1);
INSERT INTO `Login_Summary_Statistics` (`Title`, `Project`, `Value`, `QueryOrder`) VALUES ('Female Participant','Rye',62,1);
INSERT INTO `Login_Summary_Statistics` (`Title`, `Project`, `Value`, `QueryOrder`) VALUES ('Instrument','All Projects',5,5);
INSERT INTO `Login_Summary_Statistics` (`Title`, `Project`, `Value`, `QueryOrder`) VALUES ('Instrument','Challah',5,5);
INSERT INTO `Login_Summary_Statistics` (`Title`, `Project`, `Value`, `QueryOrder`) VALUES ('Instrument','Pumpernickel',5,5);
INSERT INTO `Login_Summary_Statistics` (`Title`, `Project`, `Value`, `QueryOrder`) VALUES ('Instrument','Rye',2,5);
INSERT INTO `Login_Summary_Statistics` (`Title`, `Project`, `Value`, `QueryOrder`) VALUES ('Male Participant','All Projects',328,2);
INSERT INTO `Login_Summary_Statistics` (`Title`, `Project`, `Value`, `QueryOrder`) VALUES ('Male Participant','Challah',60,2);
INSERT INTO `Login_Summary_Statistics` (`Title`, `Project`, `Value`, `QueryOrder`) VALUES ('Male Participant','Pumpernickel',210,2);
INSERT INTO `Login_Summary_Statistics` (`Title`, `Project`, `Value`, `QueryOrder`) VALUES ('Male Participant','Rye',58,2);
INSERT INTO `Login_Summary_Statistics` (`Title`, `Project`, `Value`, `QueryOrder`) VALUES ('Scan','All Projects',311,6);
INSERT INTO `Login_Summary_Statistics` (`Title`, `Project`, `Value`, `QueryOrder`) VALUES ('Scan','Challah',23,6);
INSERT INTO `Login_Summary_Statistics` (`Title`, `Project`, `Value`, `QueryOrder`) VALUES ('Scan','Pumpernickel',247,6);
INSERT INTO `Login_Summary_Statistics` (`Title`, `Project`, `Value`, `QueryOrder`) VALUES ('Scan','Rye',41,6);
INSERT INTO `Login_Summary_Statistics` (`Title`, `Project`, `Value`, `QueryOrder`) VALUES ('Site','All Projects',4,3);
INSERT INTO `Login_Summary_Statistics` (`Title`, `Project`, `Value`, `QueryOrder`) VALUES ('Site','Challah',1,3);
INSERT INTO `Login_Summary_Statistics` (`Title`, `Project`, `Value`, `QueryOrder`) VALUES ('Site','Pumpernickel',4,3);
INSERT INTO `Login_Summary_Statistics` (`Title`, `Project`, `Value`, `QueryOrder`) VALUES ('Site','Rye',1,3);
INSERT INTO `Login_Summary_Statistics` (`Title`, `Project`, `Value`, `QueryOrder`) VALUES ('Visit','All Projects',1133,4);
INSERT INTO `Login_Summary_Statistics` (`Title`, `Project`, `Value`, `QueryOrder`) VALUES ('Visit','Challah',147,4);
INSERT INTO `Login_Summary_Statistics` (`Title`, `Project`, `Value`, `QueryOrder`) VALUES ('Visit','Pumpernickel',855,4);
INSERT INTO `Login_Summary_Statistics` (`Title`, `Project`, `Value`, `QueryOrder`) VALUES ('Visit','Rye',131,4);
UNLOCK TABLES;
SET FOREIGN_KEY_CHECKS=1;
8 changes: 4 additions & 4 deletions tools/update_login_summary_statistics.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php declare(strict_types=1);

/**
* This script updates the Login Summary Statistics table in the database
* This script updates the Login_Summary_Statistics table in the database
* based on the queries that are pinned to the login page in the dataquery module,
* and on the SQL queries in the project/tools/Login_Summary_Statistics folder,
* or if that does not exist, the SQL/Login_Summary_Statistics folder.
Expand Down Expand Up @@ -66,7 +66,7 @@
);
$user = (new \User())->factory('admin');
$data = ['All Projects' => []];
$DB->run("DELETE FROM login_summary_statistics", []);
$DB->run("DELETE FROM Login_Summary_Statistics", []);
foreach ($projects as $project) {
$data[$project] = [];
}
Expand Down Expand Up @@ -155,7 +155,7 @@
foreach ($data as $project => $values) {
foreach ($values as $title => $value) {
$DB->insertOnDuplicateUpdate(
'login_summary_statistics',
'Login_Summary_Statistics',
[
'Project' => $project,
'Title' => $title,
Expand All @@ -164,4 +164,4 @@
]
);
}
}
}
Loading