mirror of
https://git.roussel.pro/telecom-paris/pact.git
synced 2026-02-09 10:30:17 +01:00
Chagnement nom tables + ajout tables stats
This commit is contained in:
@@ -9,7 +9,7 @@ import {getSourceId} from '../utils.js';
|
|||||||
*/
|
*/
|
||||||
const addAuteur = (author) => {
|
const addAuteur = (author) => {
|
||||||
return new Promise((resolve,reject) => {
|
return new Promise((resolve,reject) => {
|
||||||
const sql = "INSERT INTO auteurs (age, sexe) VALUES (?);"
|
const sql = "INSERT INTO borne_auteurs (age, sexe) VALUES (?);"
|
||||||
conn.query(sql, [[author.age, author.sexe]], (err, res) => {
|
conn.query(sql, [[author.age, author.sexe]], (err, res) => {
|
||||||
if(err) {
|
if(err) {
|
||||||
reject(err)
|
reject(err)
|
||||||
@@ -31,7 +31,7 @@ const addAuteur = (author) => {
|
|||||||
*/
|
*/
|
||||||
const addReview = (review, authorId, sourceId) => {
|
const addReview = (review, authorId, sourceId) => {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const sql = "INSERT INTO avis_borne (id_auteur, note_principale, notes_autre, commentaire, source_id) VALUES (?);"
|
const sql = "INSERT INTO borne_auteurs (id_auteur, note_principale, notes_autre, commentaire, source_id) VALUES (?);"
|
||||||
conn.query(sql, [[authorId, review.note, JSON.stringify(review.notesAutre), review.commentaire, sourceId]], (err, res) => {
|
conn.query(sql, [[authorId, review.note, JSON.stringify(review.notesAutre), review.commentaire, sourceId]], (err, res) => {
|
||||||
if(err) {
|
if(err) {
|
||||||
reject(err)
|
reject(err)
|
||||||
|
|||||||
0
code/server/update_stats.js
Normal file
0
code/server/update_stats.js
Normal file
@@ -3,7 +3,7 @@
|
|||||||
-- https://www.phpmyadmin.net/
|
-- https://www.phpmyadmin.net/
|
||||||
--
|
--
|
||||||
-- Host: localhost:3306
|
-- Host: localhost:3306
|
||||||
-- Generation Time: Dec 24, 2022 at 10:59 PM
|
-- Generation Time: Dec 25, 2022 at 06:12 PM
|
||||||
-- Server version: 8.0.31-0ubuntu0.20.04.1
|
-- Server version: 8.0.31-0ubuntu0.20.04.1
|
||||||
-- PHP Version: 7.4.3
|
-- PHP Version: 7.4.3
|
||||||
|
|
||||||
@@ -25,10 +25,10 @@ SET time_zone = "+00:00";
|
|||||||
-- --------------------------------------------------------
|
-- --------------------------------------------------------
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Table structure for table `auteurs`
|
-- Table structure for table `borne_auteurs`
|
||||||
--
|
--
|
||||||
|
|
||||||
CREATE TABLE `auteurs` (
|
CREATE TABLE `borne_auteurs` (
|
||||||
`id` int NOT NULL,
|
`id` int NOT NULL,
|
||||||
`sexe` tinytext CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci,
|
`sexe` tinytext CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci,
|
||||||
`age` tinyint DEFAULT NULL
|
`age` tinyint DEFAULT NULL
|
||||||
@@ -37,10 +37,10 @@ CREATE TABLE `auteurs` (
|
|||||||
-- --------------------------------------------------------
|
-- --------------------------------------------------------
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Table structure for table `avis_borne`
|
-- Table structure for table `borne_avis`
|
||||||
--
|
--
|
||||||
|
|
||||||
CREATE TABLE `avis_borne` (
|
CREATE TABLE `borne_avis` (
|
||||||
`id` int NOT NULL,
|
`id` int NOT NULL,
|
||||||
`id_auteur` int NOT NULL,
|
`id_auteur` int NOT NULL,
|
||||||
`date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
`date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
@@ -101,13 +101,64 @@ INSERT INTO `sources` (`id`, `nom`) VALUES
|
|||||||
|
|
||||||
-- --------------------------------------------------------
|
-- --------------------------------------------------------
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Table structure for table `stats_annee`
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE TABLE `stats_annee` (
|
||||||
|
`id` int NOT NULL,
|
||||||
|
`date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
`moyenne_globale` float NOT NULL,
|
||||||
|
`moyenne_site` float NOT NULL,
|
||||||
|
`moyenne_borne` float NOT NULL,
|
||||||
|
`moyenne_autres` text NOT NULL COMMENT 'Nombres séparés par des ; => moyennes spécifiques',
|
||||||
|
`dist_age` text NOT NULL COMMENT 'Distribution de l''age des auteurs',
|
||||||
|
`dist_sexe` text NOT NULL COMMENT 'Distribution du sexe des auteurs'
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
|
||||||
|
|
||||||
|
-- --------------------------------------------------------
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Table structure for table `stats_jour`
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE TABLE `stats_jour` (
|
||||||
|
`id` int NOT NULL,
|
||||||
|
`date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
`moyenne_globale` float NOT NULL,
|
||||||
|
`moyenne_site` float NOT NULL,
|
||||||
|
`moyenne_borne` float NOT NULL,
|
||||||
|
`moyenne_autres` text NOT NULL COMMENT 'Nombres séparés par des ; => moyennes spécifiques',
|
||||||
|
`dist_age` text NOT NULL COMMENT 'Distribution de l''age des auteurs',
|
||||||
|
`dist_sexe` text NOT NULL COMMENT 'Distribution du sexe des auteurs'
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
|
||||||
|
|
||||||
|
-- --------------------------------------------------------
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Table structure for table `stats_mois`
|
-- Table structure for table `stats_mois`
|
||||||
--
|
--
|
||||||
|
|
||||||
CREATE TABLE `stats_mois` (
|
CREATE TABLE `stats_mois` (
|
||||||
`id` int NOT NULL,
|
`id` int NOT NULL,
|
||||||
`ddate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
`date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
`moyenne_globale` float NOT NULL,
|
||||||
|
`moyenne_site` float NOT NULL,
|
||||||
|
`moyenne_borne` float NOT NULL,
|
||||||
|
`moyenne_autres` text NOT NULL COMMENT 'Nombres séparés par des ; => moyennes spécifiques',
|
||||||
|
`dist_age` text NOT NULL COMMENT 'Distribution de l''age des auteurs',
|
||||||
|
`dist_sexe` text NOT NULL COMMENT 'Distribution du sexe des auteurs'
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
|
||||||
|
|
||||||
|
-- --------------------------------------------------------
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Table structure for table `stats_semaine`
|
||||||
|
--
|
||||||
|
|
||||||
|
CREATE TABLE `stats_semaine` (
|
||||||
|
`id` int NOT NULL,
|
||||||
|
`date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
`moyenne_globale` float NOT NULL,
|
`moyenne_globale` float NOT NULL,
|
||||||
`moyenne_site` float NOT NULL,
|
`moyenne_site` float NOT NULL,
|
||||||
`moyenne_borne` float NOT NULL,
|
`moyenne_borne` float NOT NULL,
|
||||||
@@ -121,15 +172,15 @@ CREATE TABLE `stats_mois` (
|
|||||||
--
|
--
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Indexes for table `auteurs`
|
-- Indexes for table `borne_auteurs`
|
||||||
--
|
--
|
||||||
ALTER TABLE `auteurs`
|
ALTER TABLE `borne_auteurs`
|
||||||
ADD PRIMARY KEY (`id`);
|
ADD PRIMARY KEY (`id`);
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Indexes for table `avis_borne`
|
-- Indexes for table `borne_avis`
|
||||||
--
|
--
|
||||||
ALTER TABLE `avis_borne`
|
ALTER TABLE `borne_avis`
|
||||||
ADD PRIMARY KEY (`id`);
|
ADD PRIMARY KEY (`id`);
|
||||||
|
|
||||||
--
|
--
|
||||||
@@ -150,26 +201,44 @@ ALTER TABLE `reseaux_sociaux_avis`
|
|||||||
ALTER TABLE `sources`
|
ALTER TABLE `sources`
|
||||||
ADD PRIMARY KEY (`id`);
|
ADD PRIMARY KEY (`id`);
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Indexes for table `stats_annee`
|
||||||
|
--
|
||||||
|
ALTER TABLE `stats_annee`
|
||||||
|
ADD PRIMARY KEY (`id`);
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Indexes for table `stats_jour`
|
||||||
|
--
|
||||||
|
ALTER TABLE `stats_jour`
|
||||||
|
ADD PRIMARY KEY (`id`);
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Indexes for table `stats_mois`
|
-- Indexes for table `stats_mois`
|
||||||
--
|
--
|
||||||
ALTER TABLE `stats_mois`
|
ALTER TABLE `stats_mois`
|
||||||
ADD PRIMARY KEY (`id`);
|
ADD PRIMARY KEY (`id`);
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Indexes for table `stats_semaine`
|
||||||
|
--
|
||||||
|
ALTER TABLE `stats_semaine`
|
||||||
|
ADD PRIMARY KEY (`id`);
|
||||||
|
|
||||||
--
|
--
|
||||||
-- AUTO_INCREMENT for dumped tables
|
-- AUTO_INCREMENT for dumped tables
|
||||||
--
|
--
|
||||||
|
|
||||||
--
|
--
|
||||||
-- AUTO_INCREMENT for table `auteurs`
|
-- AUTO_INCREMENT for table `borne_auteurs`
|
||||||
--
|
--
|
||||||
ALTER TABLE `auteurs`
|
ALTER TABLE `borne_auteurs`
|
||||||
MODIFY `id` int NOT NULL AUTO_INCREMENT;
|
MODIFY `id` int NOT NULL AUTO_INCREMENT;
|
||||||
|
|
||||||
--
|
--
|
||||||
-- AUTO_INCREMENT for table `avis_borne`
|
-- AUTO_INCREMENT for table `borne_avis`
|
||||||
--
|
--
|
||||||
ALTER TABLE `avis_borne`
|
ALTER TABLE `borne_avis`
|
||||||
MODIFY `id` int NOT NULL AUTO_INCREMENT;
|
MODIFY `id` int NOT NULL AUTO_INCREMENT;
|
||||||
|
|
||||||
--
|
--
|
||||||
@@ -190,11 +259,29 @@ ALTER TABLE `reseaux_sociaux_avis`
|
|||||||
ALTER TABLE `sources`
|
ALTER TABLE `sources`
|
||||||
MODIFY `id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
|
MODIFY `id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
|
||||||
|
|
||||||
|
--
|
||||||
|
-- AUTO_INCREMENT for table `stats_annee`
|
||||||
|
--
|
||||||
|
ALTER TABLE `stats_annee`
|
||||||
|
MODIFY `id` int NOT NULL AUTO_INCREMENT;
|
||||||
|
|
||||||
|
--
|
||||||
|
-- AUTO_INCREMENT for table `stats_jour`
|
||||||
|
--
|
||||||
|
ALTER TABLE `stats_jour`
|
||||||
|
MODIFY `id` int NOT NULL AUTO_INCREMENT;
|
||||||
|
|
||||||
--
|
--
|
||||||
-- AUTO_INCREMENT for table `stats_mois`
|
-- AUTO_INCREMENT for table `stats_mois`
|
||||||
--
|
--
|
||||||
ALTER TABLE `stats_mois`
|
ALTER TABLE `stats_mois`
|
||||||
MODIFY `id` int NOT NULL AUTO_INCREMENT;
|
MODIFY `id` int NOT NULL AUTO_INCREMENT;
|
||||||
|
|
||||||
|
--
|
||||||
|
-- AUTO_INCREMENT for table `stats_semaine`
|
||||||
|
--
|
||||||
|
ALTER TABLE `stats_semaine`
|
||||||
|
MODIFY `id` int NOT NULL AUTO_INCREMENT;
|
||||||
COMMIT;
|
COMMIT;
|
||||||
|
|
||||||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||||
|
|||||||
Reference in New Issue
Block a user