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

T#3032/first enrolled column #3073

Merged
merged 7 commits into from
Jan 10, 2025
Merged
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
8 changes: 8 additions & 0 deletions dashboard/src/components/users/UsersTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,14 @@ const archiveUsers = () => {
</div>
</template>
</Column>
<Column field="firstUpdated" header="Points First Earned" :sortable="true" :class="{'flex': responsive.md.value }">
<template #header>
<i class="far fa-clock mr-1" :class="colors.getTextClass(3)" aria-hidden="true"></i>
</template>
<template #body="slotProps">
<date-cell :value="slotProps.data.firstUpdated" />
</template>
</Column>
<Column field="lastUpdated" header="Points Last Earned" :sortable="true" :class="{'flex': responsive.md.value }">
<template #header>
<i class="far fa-clock mr-1" :class="colors.getTextClass(3)" aria-hidden="true"></i>
Expand Down
96 changes: 48 additions & 48 deletions e2e-tests/cypress/e2e/users_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,22 +56,22 @@ describe('Users Tests', () => {

// default sort order is 'Points Last Earned' desc
cy.validateTable(tableSelector, [
[{ colIndex: 1, value: '[email protected]' }, { colIndex: 4, value: dateFormatter(m.clone().add(7, 'day')) }],
[{ colIndex: 1, value: '[email protected]' }, { colIndex: 4, value: dateFormatter(m.clone().add(6, 'day')) }],
[{ colIndex: 1, value: '[email protected]' }, { colIndex: 4, value: dateFormatter(m.clone().add(5, 'day')) }],
[{ colIndex: 1, value: '[email protected]' }, { colIndex: 4, value: dateFormatter(m.clone().add(4, 'day')) }],
[{ colIndex: 1, value: '[email protected]' }, { colIndex: 4, value: dateFormatter(m.clone().add(3, 'day')) }],
[{ colIndex: 1, value: '[email protected]' }, { colIndex: 4, value: dateFormatter(m.clone().add(2, 'day')) }],
[{ colIndex: 1, value: '[email protected]' }, { colIndex: 5, value: dateFormatter(m.clone().add(7, 'day')) }],
[{ colIndex: 1, value: '[email protected]' }, { colIndex: 5, value: dateFormatter(m.clone().add(6, 'day')) }],
[{ colIndex: 1, value: '[email protected]' }, { colIndex: 5, value: dateFormatter(m.clone().add(5, 'day')) }],
[{ colIndex: 1, value: '[email protected]' }, { colIndex: 5, value: dateFormatter(m.clone().add(4, 'day')) }],
[{ colIndex: 1, value: '[email protected]' }, { colIndex: 5, value: dateFormatter(m.clone().add(3, 'day')) }],
[{ colIndex: 1, value: '[email protected]' }, { colIndex: 5, value: dateFormatter(m.clone().add(2, 'day')) }],
], 5);

cy.get(`${tableSelector}`).contains('Points Last Earned').click();
cy.validateTable(tableSelector, [
[{ colIndex: 1, value: '[email protected]' }, { colIndex: 4, value: dateFormatter(m.clone().add(2, 'day')) }],
[{ colIndex: 1, value: '[email protected]' }, { colIndex: 4, value: dateFormatter(m.clone().add(3, 'day')) }],
[{ colIndex: 1, value: '[email protected]' }, { colIndex: 4, value: dateFormatter(m.clone().add(4, 'day')) }],
[{ colIndex: 1, value: '[email protected]' }, { colIndex: 4, value: dateFormatter(m.clone().add(5, 'day')) }],
[{ colIndex: 1, value: '[email protected]' }, { colIndex: 4, value: dateFormatter(m.clone().add(6, 'day')) }],
[{ colIndex: 1, value: '[email protected]' }, { colIndex: 4, value: dateFormatter(m.clone().add(7, 'day')) }],
[{ colIndex: 1, value: '[email protected]' }, { colIndex: 5, value: dateFormatter(m.clone().add(2, 'day')) }],
[{ colIndex: 1, value: '[email protected]' }, { colIndex: 5, value: dateFormatter(m.clone().add(3, 'day')) }],
[{ colIndex: 1, value: '[email protected]' }, { colIndex: 5, value: dateFormatter(m.clone().add(4, 'day')) }],
[{ colIndex: 1, value: '[email protected]' }, { colIndex: 5, value: dateFormatter(m.clone().add(5, 'day')) }],
[{ colIndex: 1, value: '[email protected]' }, { colIndex: 5, value: dateFormatter(m.clone().add(6, 'day')) }],
[{ colIndex: 1, value: '[email protected]' }, { colIndex: 5, value: dateFormatter(m.clone().add(7, 'day')) }],
], 5);

cy.get(`${tableSelector}`).contains('User').click();
Expand Down Expand Up @@ -138,12 +138,12 @@ describe('Users Tests', () => {

// default sort order is 'Points Last Earned' desc
cy.validateTable(tableSelector, [
[{ colIndex: 1, value: '[email protected]' }, { colIndex: 4, value: dateFormatter(m.clone().add(7, 'day')) }],
[{ colIndex: 1, value: '[email protected]' }, { colIndex: 4, value: dateFormatter(m.clone().add(6, 'day')) }],
[{ colIndex: 1, value: '[email protected]' }, { colIndex: 4, value: dateFormatter(m.clone().add(5, 'day')) }],
[{ colIndex: 1, value: '[email protected]' }, { colIndex: 4, value: dateFormatter(m.clone().add(4, 'day')) }],
[{ colIndex: 1, value: '[email protected]' }, { colIndex: 4, value: dateFormatter(m.clone().add(3, 'day')) }],
[{ colIndex: 1, value: '[email protected]' }, { colIndex: 4, value: dateFormatter(m.clone().add(2, 'day')) }],
[{ colIndex: 1, value: '[email protected]' }, { colIndex: 5, value: dateFormatter(m.clone().add(7, 'day')) }],
[{ colIndex: 1, value: '[email protected]' }, { colIndex: 5, value: dateFormatter(m.clone().add(6, 'day')) }],
[{ colIndex: 1, value: '[email protected]' }, { colIndex: 5, value: dateFormatter(m.clone().add(5, 'day')) }],
[{ colIndex: 1, value: '[email protected]' }, { colIndex: 5, value: dateFormatter(m.clone().add(4, 'day')) }],
[{ colIndex: 1, value: '[email protected]' }, { colIndex: 5, value: dateFormatter(m.clone().add(3, 'day')) }],
[{ colIndex: 1, value: '[email protected]' }, { colIndex: 5, value: dateFormatter(m.clone().add(2, 'day')) }],
], 5);

cy.get('[data-pc-extend="paginator"] [aria-label="Page 1"]').click()
Expand All @@ -160,10 +160,10 @@ describe('Users Tests', () => {
cy.get('[data-cy="archiveUsersTableBtn"]').should('be.disabled');

cy.validateTable(tableSelector, [
[{ colIndex: 1, value: '[email protected]' }, { colIndex: 4, value: dateFormatter(m.clone().add(7, 'day')) }],
[{ colIndex: 1, value: '[email protected]' }, { colIndex: 4, value: dateFormatter(m.clone().add(5, 'day')) }],
[{ colIndex: 1, value: '[email protected]' }, { colIndex: 4, value: dateFormatter(m.clone().add(3, 'day')) }],
[{ colIndex: 1, value: '[email protected]' }, { colIndex: 4, value: dateFormatter(m.clone().add(2, 'day')) }],
[{ colIndex: 1, value: '[email protected]' }, { colIndex: 5, value: dateFormatter(m.clone().add(7, 'day')) }],
[{ colIndex: 1, value: '[email protected]' }, { colIndex: 5, value: dateFormatter(m.clone().add(5, 'day')) }],
[{ colIndex: 1, value: '[email protected]' }, { colIndex: 5, value: dateFormatter(m.clone().add(3, 'day')) }],
[{ colIndex: 1, value: '[email protected]' }, { colIndex: 5, value: dateFormatter(m.clone().add(2, 'day')) }],
], 5);

// navigate to archived users
Expand Down Expand Up @@ -198,12 +198,12 @@ describe('Users Tests', () => {

cy.wait('@getUsers')
cy.validateTable(tableSelector, [
[{ colIndex: 1, value: '[email protected]' }, { colIndex: 4, value: dateFormatter(m.clone().add(7, 'day')) }],
[{ colIndex: 1, value: '[email protected]' }, { colIndex: 4, value: dateFormatter(m.clone().add(6, 'day')) }],
[{ colIndex: 1, value: '[email protected]' }, { colIndex: 4, value: dateFormatter(m.clone().add(5, 'day')) }],
[{ colIndex: 1, value: '[email protected]' }, { colIndex: 4, value: dateFormatter(m.clone().add(4, 'day')) }],
[{ colIndex: 1, value: '[email protected]' }, { colIndex: 4, value: dateFormatter(m.clone().add(3, 'day')) }],
[{ colIndex: 1, value: '[email protected]' }, { colIndex: 4, value: dateFormatter(m.clone().add(2, 'day')) }],
[{ colIndex: 1, value: '[email protected]' }, { colIndex: 5, value: dateFormatter(m.clone().add(7, 'day')) }],
[{ colIndex: 1, value: '[email protected]' }, { colIndex: 5, value: dateFormatter(m.clone().add(6, 'day')) }],
[{ colIndex: 1, value: '[email protected]' }, { colIndex: 5, value: dateFormatter(m.clone().add(5, 'day')) }],
[{ colIndex: 1, value: '[email protected]' }, { colIndex: 5, value: dateFormatter(m.clone().add(4, 'day')) }],
[{ colIndex: 1, value: '[email protected]' }, { colIndex: 5, value: dateFormatter(m.clone().add(3, 'day')) }],
[{ colIndex: 1, value: '[email protected]' }, { colIndex: 5, value: dateFormatter(m.clone().add(2, 'day')) }],
], 5);

cy.get('[data-p-index="0"] [data-pc-name="rowcheckbox"]').click()
Expand Down Expand Up @@ -1050,7 +1050,7 @@ describe('Users Tests', () => {
cy.clickNav('Users');
cy.wait('@getUsers')

cy.get(`${tableSelector} th`).should('have.length', 5)
cy.get(`${tableSelector} th`).should('have.length', 6)
cy.get(`${tableSelector}`).should('contain', 'Org');
cy.validateTable(tableSelector, [
[{colIndex: 2, value: 'tagA'}],
Expand Down Expand Up @@ -1093,7 +1093,7 @@ describe('Users Tests', () => {
cy.wait('@loadConfig')
cy.clickNav('Users');
cy.wait('@getUsers')
cy.get(`${tableSelector} th`).should('have.length', 4)
cy.get(`${tableSelector} th`).should('have.length', 5)
cy.get(`${tableSelector}`).should('not.contain', 'Org');
});

Expand Down Expand Up @@ -1136,7 +1136,7 @@ describe('Users Tests', () => {
cy.clickNav('Users');
cy.wait('@getUsers')

cy.get(`${tableSelector} th`).should('have.length', 5)
cy.get(`${tableSelector} th`).should('have.length', 6)

cy.get(`${tableSelector} [data-cy="usersTable_viewDetailsLink"]`).first().click();
cy.wait('@getUserTags')
Expand Down Expand Up @@ -1174,7 +1174,7 @@ describe('Users Tests', () => {
cy.clickNav('Users');
cy.wait('@getUsers')

cy.get(`${tableSelector} th`).should('have.length', 5)
cy.get(`${tableSelector} th`).should('have.length', 6)

cy.get(`${tableSelector} [data-cy="usersTable_viewDetailsLink"]`).first().click();
cy.contains("Client Display");
Expand All @@ -1193,50 +1193,50 @@ describe('Users Tests', () => {

// default sort order is 'Points Last Earned' desc
cy.validateTable(tableSelector, [
[{ colIndex: 1, value: '[email protected]' }, { colIndex: 4, value: dateFormatter(m.clone().add(7, 'day')) }],
[{ colIndex: 1, value: '[email protected]' }, { colIndex: 4, value: dateFormatter(m.clone().add(6, 'day')) }],
[{ colIndex: 1, value: '[email protected]' }, { colIndex: 4, value: dateFormatter(m.clone().add(5, 'day')) }],
[{ colIndex: 1, value: '[email protected]' }, { colIndex: 4, value: dateFormatter(m.clone().add(4, 'day')) }],
[{ colIndex: 1, value: '[email protected]' }, { colIndex: 4, value: dateFormatter(m.clone().add(3, 'day')) }],
[{ colIndex: 1, value: '[email protected]' }, { colIndex: 4, value: dateFormatter(m.clone().add(2, 'day')) }],
[{ colIndex: 1, value: '[email protected]' }, { colIndex: 5, value: dateFormatter(m.clone().add(7, 'day')) }],
[{ colIndex: 1, value: '[email protected]' }, { colIndex: 5, value: dateFormatter(m.clone().add(6, 'day')) }],
[{ colIndex: 1, value: '[email protected]' }, { colIndex: 5, value: dateFormatter(m.clone().add(5, 'day')) }],
[{ colIndex: 1, value: '[email protected]' }, { colIndex: 5, value: dateFormatter(m.clone().add(4, 'day')) }],
[{ colIndex: 1, value: '[email protected]' }, { colIndex: 5, value: dateFormatter(m.clone().add(3, 'day')) }],
[{ colIndex: 1, value: '[email protected]' }, { colIndex: 5, value: dateFormatter(m.clone().add(2, 'day')) }],
], 5);

cy.get('[data-cy=users-progress-input]').type('{selectall}50')
cy.get('[data-cy="users-filterBtn"]').click();
// users-progress-input

cy.validateTable(tableSelector, [
[{ colIndex: 1, value: '[email protected]' }, { colIndex: 4, value: dateFormatter(m.clone().add(7, 'day')) }],
[{ colIndex: 1, value: '[email protected]' }, { colIndex: 4, value: dateFormatter(m.clone().add(6, 'day')) }],
[{ colIndex: 1, value: '[email protected]' }, { colIndex: 4, value: dateFormatter(m.clone().add(5, 'day')) }],
[{ colIndex: 1, value: '[email protected]' }, { colIndex: 4, value: dateFormatter(m.clone().add(4, 'day')) }],
[{ colIndex: 1, value: '[email protected]' }, { colIndex: 5, value: dateFormatter(m.clone().add(7, 'day')) }],
[{ colIndex: 1, value: '[email protected]' }, { colIndex: 5, value: dateFormatter(m.clone().add(6, 'day')) }],
[{ colIndex: 1, value: '[email protected]' }, { colIndex: 5, value: dateFormatter(m.clone().add(5, 'day')) }],
[{ colIndex: 1, value: '[email protected]' }, { colIndex: 5, value: dateFormatter(m.clone().add(4, 'day')) }],
], 5);

cy.get('[data-cy=users-progress-input]').type('{selectall}60')
cy.get('[data-cy="users-filterBtn"]').click();
// users-progress-input

cy.validateTable(tableSelector, [
[{ colIndex: 1, value: '[email protected]' }, { colIndex: 4, value: dateFormatter(m.clone().add(7, 'day')) }],
[{ colIndex: 1, value: '[email protected]' }, { colIndex: 4, value: dateFormatter(m.clone().add(6, 'day')) }],
[{ colIndex: 1, value: '[email protected]' }, { colIndex: 4, value: dateFormatter(m.clone().add(5, 'day')) }],
[{ colIndex: 1, value: '[email protected]' }, { colIndex: 5, value: dateFormatter(m.clone().add(7, 'day')) }],
[{ colIndex: 1, value: '[email protected]' }, { colIndex: 5, value: dateFormatter(m.clone().add(6, 'day')) }],
[{ colIndex: 1, value: '[email protected]' }, { colIndex: 5, value: dateFormatter(m.clone().add(5, 'day')) }],
], 5);

cy.get('[data-cy=users-progress-input]').type('{selectall}70')
cy.get('[data-cy="users-filterBtn"]').click();
// users-progress-input

cy.validateTable(tableSelector, [
[{ colIndex: 1, value: '[email protected]' }, { colIndex: 4, value: dateFormatter(m.clone().add(7, 'day')) }],
[{ colIndex: 1, value: '[email protected]' }, { colIndex: 4, value: dateFormatter(m.clone().add(6, 'day')) }],
[{ colIndex: 1, value: '[email protected]' }, { colIndex: 5, value: dateFormatter(m.clone().add(7, 'day')) }],
[{ colIndex: 1, value: '[email protected]' }, { colIndex: 5, value: dateFormatter(m.clone().add(6, 'day')) }],
], 5);

cy.get('[data-cy=users-progress-input]').type('{selectall}80')
cy.get('[data-cy="users-filterBtn"]').click();
// users-progress-input

cy.validateTable(tableSelector, [
[{ colIndex: 1, value: '[email protected]' }, { colIndex: 4, value: dateFormatter(m.clone().add(7, 'day')) }],
[{ colIndex: 1, value: '[email protected]' }, { colIndex: 5, value: dateFormatter(m.clone().add(7, 'day')) }],
], 5);

cy.get('[data-cy=users-progress-input]').type('{selectall}90')
Expand Down
23 changes: 15 additions & 8 deletions service/src/main/java/skills/storage/repos/UserPointsRepo.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -771,8 +771,9 @@ interface UserPointsRepo extends CrudRepository<UserPoints, Integer> {
Long countDistinctUserIdByProjectIdAndSkillIdInAndUserIdLike(String projectId, List<String> skillIds, String query, int minimumPoints)

@Query(value = '''SELECT
up.user_id as userId,
max(upa.performedOn) as lastUpdated,
up.user_id as userId,
max(upa.firstPerformedOn) as firstUpdated,
max(upa.lastPerformedOn) as lastUpdated,
sum(up.points) as totalPoints,
max(ua.first_name) as firstName,
max(ua.last_name) as lastName,
Expand All @@ -783,7 +784,8 @@ interface UserPointsRepo extends CrudRepository<UserPoints, Integer> {
FROM user_points up
LEFT JOIN (
SELECT upa.user_id,
max(upa.performed_on) AS performedOn
min(upa.performed_on) AS firstPerformedOn,
max(upa.performed_on) AS lastPerformedOn
FROM user_performed_skill upa
WHERE upa.skill_ref_id in (
select case when copied_from_skill_ref is not null then copied_from_skill_ref else id end as id from skill_definition sd where type = 'Skill' and sd.project_id = ?1 and sd.skill_id in (?3)
Expand All @@ -805,7 +807,8 @@ interface UserPointsRepo extends CrudRepository<UserPoints, Integer> {

@Query(value = '''SELECT
up.user_id as userId,
max(upa.performedOn) as lastUpdated,
min(upa.firstPerformedOn) as firstUpdated,
max(upa.lastPerformedOn) as lastUpdated,
sum(up.points) as totalPoints,
max(ua.first_name) as firstName,
max(ua.last_name) as lastName,
Expand All @@ -816,7 +819,8 @@ interface UserPointsRepo extends CrudRepository<UserPoints, Integer> {
FROM user_points up
LEFT JOIN (
SELECT upa.user_id,
max(upa.performed_on) AS performedOn
min(upa.performed_on) AS firstPerformedOn,
max(upa.performed_on) AS lastPerformedOn
FROM user_performed_skill upa
WHERE upa.skill_ref_id in (
select case when copied_from_skill_ref is not null then copied_from_skill_ref else id end as id from skill_definition where type = 'Skill' and project_id = ?1 and enabled = 'true'
Expand Down Expand Up @@ -856,7 +860,8 @@ interface UserPointsRepo extends CrudRepository<UserPoints, Integer> {
)
SELECT
up.user_id as userId,
max(upa.performedOn) as lastUpdated,
min(upa.firstPerformedOn) as firstUpdated,
max(upa.lastPerformedOn) as lastUpdated,
sum(up.points) as totalPoints,
max(ua.first_name) as firstName,
max(ua.last_name) as lastName,
Expand All @@ -868,10 +873,12 @@ interface UserPointsRepo extends CrudRepository<UserPoints, Integer> {
FROM user_points up
LEFT JOIN (
SELECT upa.user_id,
max(upa.performed_on) AS performedOn
min(upa.performed_on) AS firstPerformedOn,
max(upa.performed_on) AS lastPerformedOn
FROM user_performed_skill upa
WHERE upa.skill_ref_id in (
select case when copied_from_skill_ref is not null then copied_from_skill_ref else id end as id from skill_definition where type = 'Skill' and project_id = :projectId and exists (select 1 from subj_skills s_s where s_s.id = id)
select case when copied_from_skill_ref is not null then copied_from_skill_ref else id end as id from skill_definition
where type = 'Skill' and project_id = :projectId and id in (select s_s.id from subj_skills s_s where s_s.id = id)
)
GROUP BY upa.user_id
) upa ON upa.user_id = up.user_id
Expand Down
Loading
Loading