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

Remove feedbackcount col #1428

Merged
merged 21 commits into from
Jan 27, 2025
Merged
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
7538347
fix: Use summary.feedbackCount instead of fbt.feedbackCount in CU con…
Veikkosuhonen Jan 8, 2025
88aa143
chore: Convert feedback model to ts
Veikkosuhonen Jan 8, 2025
f727462
fix: Add hooks to feedback for updating corresponding summary upon cr…
Veikkosuhonen Jan 8, 2025
f2f6e49
doc: Add comment
Veikkosuhonen Jan 8, 2025
bf31f7a
Update summary data of fbt when creating or destroying feedback
Veikkosuhonen Jan 8, 2025
a405370
Update cached feedbackCount properly & use it on fbt page
Veikkosuhonen Jan 8, 2025
c16a278
Merge master
Veikkosuhonen Jan 8, 2025
0a7f368
chore: Formatting
Veikkosuhonen Jan 8, 2025
4670d11
fix: Handle case where no cached fbt
Veikkosuhonen Jan 9, 2025
1a77ab3
fix: Summaries for interim feedback
Veikkosuhonen Jan 9, 2025
af0dea9
fix: Add missing file
Veikkosuhonen Jan 9, 2025
62b7f2e
fix: Remove many usages of feedbackCount column
Veikkosuhonen Jan 13, 2025
d5c5397
fix: Unique summary feedback_target_id, no seq hooks
Veikkosuhonen Jan 13, 2025
db106e1
fix: Remove hopefully last usages of feedbackCount column
Veikkosuhonen Jan 13, 2025
9ceec9d
fix!: Drop unused feedback count column and remove a related data pop…
Veikkosuhonen Jan 13, 2025
c5fc9eb
fix: feedbackCount wrongly calculated for summaries
Veikkosuhonen Jan 13, 2025
201ddf2
fix: Migration has to delete most existing summaries
Veikkosuhonen Jan 20, 2025
07ca821
fix!: Accept having multiple summaries per fbt. All are kept up to date.
Veikkosuhonen Jan 22, 2025
aed440a
fix: Bug in updateAfterFeedbackDestroyed
Veikkosuhonen Jan 22, 2025
1bfe70e
fix: Cleanup & do not use userCreated summaries for higher stats
Veikkosuhonen Jan 22, 2025
0428588
fix: Exclude userCreated feedbackTargetSummaries from other stats whe…
Veikkosuhonen Jan 23, 2025
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
Next Next commit
fix: Use summary.feedbackCount instead of fbt.feedbackCount in CU con…
…troller
  • Loading branch information
Veikkosuhonen committed Jan 8, 2025
commit 75383474fbcc7694613d76e7dcb72d6af9f106f8
18 changes: 15 additions & 3 deletions src/server/routes/courseUnits/courseUnitController.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,15 @@ const { Router } = require('express')
const { Op } = require('sequelize')
const _ = require('lodash')

const { UserFeedbackTarget, FeedbackTarget, CourseRealisation, CourseUnit, Organisation, Tag } = require('../../models')
const {
UserFeedbackTarget,
FeedbackTarget,
CourseRealisation,
CourseUnit,
Organisation,
Tag,
Summary,
} = require('../../models')

const { sequelize } = require('../../db/dbConnection')
const { INCLUDE_COURSES } = require('../../util/config')
Expand Down Expand Up @@ -60,7 +68,6 @@ const getCourseUnitsForTeacher = async (req, res) => {
'closesAt',
['feedback_response_email_sent', 'feedbackResponseSent'],
[sequelize.literal(`length(feedback_response) > 3`), 'feedbackResponseGiven'],
'feedbackCount',
'continuousFeedbackEnabled',
'userCreated',
],
Expand Down Expand Up @@ -95,6 +102,11 @@ const getCourseUnitsForTeacher = async (req, res) => {
},
],
},
include: {
model: Summary,
required: false,
as: 'summary',
},
},
{
model: CourseUnit,
Expand Down Expand Up @@ -169,7 +181,7 @@ const getCourseUnitsForTeacher = async (req, res) => {
...feedbackTarget.courseRealisation.toJSON(),
feedbackResponseGiven: feedbackTarget.dataValues.feedbackResponseGiven,
feedbackResponseSent: feedbackTarget.dataValues.feedbackResponseSent,
feedbackCount: Number(feedbackTarget.dataValues.feedbackCount),
feedbackCount: Number(feedbackTarget.courseRealisation.summary?.feedbackCount ?? 0),
feedbackTarget: _.pick(feedbackTarget, targetFields),
}
: null
Expand Down