Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/vil 579 2 modification des requetes #1019

Open
wants to merge 52 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
d9a84d2
Merge branch 'master' of https://github.com/parlemonde/1village into …
SimNed Sep 2, 2024
c6ac6ab
add AnaltyicSession migration
SimNed Sep 3, 2024
7d7afee
add user is not null verification to classroomStats and sessionStats
SimNed Sep 3, 2024
d713582
add migration
SimNed Sep 3, 2024
2b0ea29
update struct in work
SimNed Sep 4, 2024
de9f9e3
Merge branch 'master' of https://github.com/parlemonde/1village into …
SimNed Sep 9, 2024
7ab29c6
VIL-579-2modification des fonction de requetes
dodoLaprovence Oct 10, 2024
072b9dc
VIL-579-2modification des fonction de requetes
dodoLaprovence Oct 10, 2024
7c2aab1
VIL-579-2modification des fonction de requetes
dodoLaprovence Oct 10, 2024
ab0a720
VIL-579-2modification des fonction de requetes
dodoLaprovence Oct 10, 2024
c3cd756
modification des requetes et de la page dashboard
dodoLaprovence Nov 11, 2024
09b6c61
linter mondification
dodoLaprovence Nov 11, 2024
f441412
conflict branch
dodoLaprovence Nov 11, 2024
f30b34b
linter order import
dodoLaprovence Nov 11, 2024
5137e09
linter order import
dodoLaprovence Nov 11, 2024
3af8de4
typescript error
dodoLaprovence Nov 11, 2024
985336a
fusion des changements
dodoLaprovence Dec 11, 2024
b8f98f0
fusion des changements
dodoLaprovence Dec 11, 2024
c47f322
fusion des changements
dodoLaprovence Dec 11, 2024
1119fcd
conflict server
dodoLaprovence Dec 12, 2024
a316f50
conflict server
dodoLaprovence Dec 12, 2024
1ad6f62
conflict server
dodoLaprovence Dec 12, 2024
ce4ad76
conflict server
dodoLaprovence Dec 12, 2024
062c66a
add AnaltyicSession migration
SimNed Sep 3, 2024
00171ea
add user is not null verification to classroomStats and sessionStats
SimNed Sep 3, 2024
18d503c
add migration
SimNed Sep 3, 2024
6c317f4
update struct in work
SimNed Sep 4, 2024
3d59ba1
VIL-579-2modification des fonction de requetes
dodoLaprovence Oct 10, 2024
db3fdfa
VIL-579-2modification des fonction de requetes
dodoLaprovence Oct 10, 2024
4699522
VIL-579-2modification des fonction de requetes
dodoLaprovence Oct 10, 2024
a7d440a
VIL-579-2modification des fonction de requetes
dodoLaprovence Oct 10, 2024
a6db0c9
modification des requetes et de la page dashboard
dodoLaprovence Nov 11, 2024
ad5063f
linter mondification
dodoLaprovence Nov 11, 2024
84fcfcb
linter order import
dodoLaprovence Nov 11, 2024
a31caa3
linter order import
dodoLaprovence Nov 11, 2024
b2d51f6
typescript error
dodoLaprovence Nov 11, 2024
43184bd
fusion des changements
dodoLaprovence Dec 11, 2024
a39d219
fusion des changements
dodoLaprovence Dec 11, 2024
5844e79
fusion des changements
dodoLaprovence Dec 11, 2024
dc95c08
conflict server
dodoLaprovence Dec 12, 2024
7aa3470
conflict server
dodoLaprovence Dec 12, 2024
9efa3ee
conflict server
dodoLaprovence Dec 12, 2024
aafb926
conflict server
dodoLaprovence Dec 12, 2024
ee6e9ae
Merge remote-tracking branch 'origin/feat/VIL-579-2-modification-des-…
dodoLaprovence Dec 12, 2024
698bac3
Merge branch 'master' into feat/VIL-579-2-modification-des-requetes
dodoLaprovence Dec 17, 2024
9f0a098
clean yarn
dodoLaprovence Dec 17, 2024
21a0559
clean yarn
dodoLaprovence Dec 17, 2024
41b4de5
clean yarn
dodoLaprovence Dec 17, 2024
1794819
linter error
dodoLaprovence Dec 17, 2024
d606a0c
typescript error
dodoLaprovence Dec 17, 2024
3767f1a
typescript error
dodoLaprovence Dec 17, 2024
13bd759
typescript error
dodoLaprovence Dec 17, 2024
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
58,933 changes: 29,580 additions & 29,353 deletions .pnp.cjs
100644 → 100755

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
}
},
"sqltools.connections": []
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
1,396 changes: 1,396 additions & 0 deletions 1village_db_default.sql

Large diffs are not rendered by default.

Empty file added MySQL Local.session.sql
Empty file.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@
"react-player": "^2.10.1",
"react-query": "^3.39.2",
"react-simple-maps": "^3.0.0",
"recharts": "^2.13.3",
"resize-observer-polyfill": "^1.5.1",
"safe-buffer": "^5.2.1",
"sass": "^1.53.0",
Expand Down
23 changes: 21 additions & 2 deletions server/controllers/analytic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ analyticController.router.post(
});
}

// Retrieve current user session or save the new one.
// Retrieve current user session or save the new one.
// eslint-disable-next-line prefer-const
let [sessionCount, userPhase] = await Promise.all([
Expand All @@ -296,8 +297,26 @@ analyticController.router.post(
session.width = data.width || 0;
session.duration = null;
session.initialPage = data.location;
session.userId = data.userId ?? null;
// TODO debug phase
session.userId = data.userId ?? 1;
session.phase = userPhase ? userPhase.firstlogin : 0;

await AppDataSource.getRepository(AnalyticSession).save(session);
sessionCount = 1;
}

if (sessionCount === 0 && data.event === 'pageview' && data.params?.isInitial) {
const session = new AnalyticSession();
session.id = data.sessionId;
session.uniqueId = uniqueSessionId;
session.date = new Date();
session.browserName = req.useragent?.browser ?? '';
session.browserVersion = req.useragent?.version ?? '';
session.os = req.useragent?.os ?? '';
session.type = req.useragent?.isDesktop ? 'desktop' : req.useragent?.isTablet ? 'tablet' : req.useragent?.isMobile ? 'mobile' : 'other';
session.width = data.width || 0;
session.duration = null;
session.initialPage = data.location;
session.userId = data.userId ?? 1;
session.phase = userPhase ? userPhase.firstlogin : 0;

await AppDataSource.getRepository(AnalyticSession).save(session);
Expand Down
29 changes: 13 additions & 16 deletions server/controllers/classroom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,21 @@ export const classroomController = new Controller('/classrooms');
* @param {object} res Express response object
* @return {object} Route API JSON response
*/

classroomController.get({ path: '', userType: UserType.ADMIN }, async (_req: Request, res: Response) => {
const villageId = _req.query.villageId as string;
classroomController.get({ path: '/', userType: UserType.TEACHER }, async (req: Request, res: Response, next: NextFunction) => {
try {
const classroomRepository = AppDataSource.getRepository(Classroom);
let classrooms;
if (villageId) {
const query = classroomRepository.createQueryBuilder('classroom').leftJoinAndSelect('classroom.user', 'user');
query.where('classroom.villageId = :villageId', { villageId });

classrooms = await query.getMany();
} else {
classrooms = await classroomRepository.find();
const classrooms = await AppDataSource.getRepository(Classroom).find({
relations: {
user: true,
},
});

if (!classrooms) {
return res.status(404).json({ message: 'No classrooms found' });
}
res.sendJSON(classrooms);
} catch (e) {
console.error(e);
res.status(500).sendJSON({ message: 'An error occurred while fetching classrooms' });

res.json(classrooms);
} catch (error) {
next(error);
}
});

Expand Down
Loading
Loading