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
Show file tree
Hide file tree
Changes from 20 commits
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
9 changes: 5 additions & 4 deletions cypress/integration/emailStatsView.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/// <reference types="Cypress" />

import { admin } from '../fixtures/headers'
import { admin, student } from '../fixtures/headers'

describe('Admin email stats view', () => {
beforeEach(() => {
Expand All @@ -24,10 +24,11 @@ describe('Admin email stats view', () => {
cy.contains('[email protected]')
cy.contains('now open: Testauskurssi')
})
it('shows the email when feedback response reminder should be sent', () => {
cy.setFakeFeedbackCount(10)
cy.setFeedbackClosed()
it.only('shows the email when feedback response reminder should be sent', () => {
cy.loginAs(admin)
cy.setFeedbackActive()
cy.giveFeedback(student)
cy.setFeedbackClosed()
cy.visit(`/admin/misc`)
cy.contains('Email statistics').click()
cy.contains('Student emails TODAY: 0')
Expand Down
72 changes: 72 additions & 0 deletions cypress/integration/feedbackCount.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
const { teacher, student } = require('../fixtures/headers')

/// <reference types="Cypress" />

describe('Feedback count', () => {
beforeEach(() => {
cy.createFeedbackTarget({ extraStudents: 5 })
cy.setFeedbackActive()
cy.getTestFbtId().as('fbtId')
})

it('Feedback count increases everywhere when a student gives feedback', () => {
cy.loginAs(teacher)
// Initial feedback count on my teaching page
cy.visit('/courses')
cy.get('@fbtId')
.then(id => cy.get(`[data-cy="my-teaching-feedback-target-secondary-text-${id}"]`))
.invoke('text')
.then(text => {
cy.wrap(text).as('myTeachingInitialCount')
})

// Initial feedback count on feedback page
cy.get('@fbtId').then(id => cy.visit(`/targets/${id}`))
cy.get('[data-cy=feedback-target-feedback-count-percentage]')
.invoke('text')
.then(text => {
cy.wrap(text).as('fbtPageInitialCount')
})

// Student gives feedback
cy.loginAs(student)
cy.get('[data-cy="navbar-link-My feedback"]').click()
cy.get('[data-cy=feedback-item-give-feedback]').click()
cy.contains('This feedback is anonymous. Fields marked with an asterisk (*) are required')
cy.get('input[value=5]').each($el => {
cy.get($el).click()
})
cy.getUniversityQuestions().then(questions => {
const openQuestion = questions.find(q => q.type === 'OPEN')
cy.get(`textarea[id=${openQuestion.id}-label]`).type('Other comments and such')
})
cy.get('[data-cy=feedback-view-give-feedback]').click()
cy.contains('Feedback has been given. Thank you for your feedback!')

// Verify feedback count increased on feedback page
cy.loginAs(teacher)
cy.get('@fbtId').then(id => cy.visit(`/targets/${id}`))
cy.get('[data-cy=feedback-target-feedback-count-percentage]')
.invoke('text')
.then(newCount => {
cy.get('@fbtPageInitialCount').then(initialCount => {
const newCountInt = parseInt(newCount.split("/")[0], 10)
const initialCountInt = parseInt(initialCount.split("/")[0], 10)
expect(newCountInt).to.eq(initialCountInt + 1)
})
})

// Verify feedback count increased on my teaching page
cy.visit('/courses')
cy.get('@fbtId')
.then(id => cy.get(`[data-cy="my-teaching-feedback-target-secondary-text-${id}"]`))
.invoke('text')
.then(newCount => {
cy.get('@myTeachingInitialCount').then(initialCount => {
const newCountInt = parseInt(newCount.split('/')[0], 10)
const initialCountInt = parseInt(initialCount.split('/')[0], 10)
expect(newCountInt).to.eq(initialCountInt + 1)
})
})
})
})
34 changes: 10 additions & 24 deletions cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,17 @@ Cypress.Commands.add('buildSummaries', () => {

Cypress.Commands.add('giveFeedback', headers => {
cy.getTestFbtId().then(id => {
cy.getUniversityQuestions()
.then(questionIds => {
cy.request({
method: 'POST',
url: '/api/feedbacks',
headers,
body: {
feedbackTargetId: id,
data: questionIds.map(q => ({ questionId: q.id, data: '3' })),
},
})
cy.getUniversityQuestions().then(questionIds => {
cy.request({
method: 'POST',
url: '/api/feedbacks',
headers,
body: {
feedbackTargetId: id,
data: questionIds.map(q => ({ questionId: q.id, data: '3' })),
},
})
.then(() => cy.buildSummaries())
})
})
})

Expand Down Expand Up @@ -230,18 +228,6 @@ Cypress.Commands.add('setFeedbackOpeningSoon', () => {
setFeedbackDatesFromNow(6, 28)
})

Cypress.Commands.add('setFakeFeedbackCount', feedbackCount => {
cy.getTestFbtId().then(id => {
cy.request({
method: 'PUT',
url: `/test/courseRealisation/${id}`,
body: {
feedbackCount,
},
})
})
})

Cypress.Commands.add('setContinuousFeedbackActive', () => {
cy.getTestFbtId().then(id => {
cy.request({
Expand Down
Loading
Loading