diff --git a/packages/client/src/components/ClosingDatesTable.spec.js b/packages/client/src/components/ClosingDatesTable.spec.js deleted file mode 100644 index 88ea135f2..000000000 --- a/packages/client/src/components/ClosingDatesTable.spec.js +++ /dev/null @@ -1,27 +0,0 @@ -import ClosingDatesTable from '@/components/ClosingDatesTable.vue'; - -import { - describe, it, expect, vi, -} from 'vitest'; -import { shallowMount, createLocalVue } from '@vue/test-utils'; -import { BootstrapVue } from 'bootstrap-vue'; - -describe('ClosingDatesTable component', () => { - const localVue = createLocalVue(); - localVue.use(BootstrapVue); - - it('renders', () => { - const wrapper = shallowMount(ClosingDatesTable, { - propsData: { - closestGrants: [{ - title: 'foo', - close_date: new Date(), - }], - onRowSelected: vi.fn(), - onRowClicked: vi.fn(), - }, - localVue, - }); - expect(wrapper.exists()).toBe(true); - }); -}); diff --git a/packages/client/src/components/ClosingDatesTable.vue b/packages/client/src/components/ClosingDatesTable.vue deleted file mode 100644 index 663cdda47..000000000 --- a/packages/client/src/components/ClosingDatesTable.vue +++ /dev/null @@ -1,106 +0,0 @@ - - - - - diff --git a/packages/client/src/router/index.js b/packages/client/src/router/index.js index 474620ea1..d9be055b3 100644 --- a/packages/client/src/router/index.js +++ b/packages/client/src/router/index.js @@ -64,14 +64,6 @@ export const routes = [ requiresAuth: true, }, }, - { - path: '/UpcomingClosingDates', - name: 'UpcomingClosingDates', - component: () => import('@/views/UpcomingClosingDatesView.vue'), - meta: { - requiresAuth: true, - }, - }, { path: '/grants', name: 'grants', diff --git a/packages/client/src/views/DashboardView.spec.js b/packages/client/src/views/DashboardView.spec.js index 847a93232..3a8b5a8ca 100644 --- a/packages/client/src/views/DashboardView.spec.js +++ b/packages/client/src/views/DashboardView.spec.js @@ -64,9 +64,5 @@ describe('DashboardView.vue', () => { const noRecentActivityMessage = wrapper.find('#noRecentActivityMessage'); expect(noRecentActivityMessage.text()).toContain('Your team has no recent activity.'); }); - it('should show the no recent activity message', () => { - const noRecentActivityMessage = wrapper.find('#noUpcomingCloseDates'); - expect(noRecentActivityMessage.text()).toContain('Your team has no upcoming close dates.'); - }); }); }); diff --git a/packages/client/src/views/DashboardView.vue b/packages/client/src/views/DashboardView.vue index 204be4ea2..a0a6f80e8 100644 --- a/packages/client/src/views/DashboardView.vue +++ b/packages/client/src/views/DashboardView.vue @@ -4,7 +4,6 @@
-
@@ -40,43 +39,6 @@
- - -
-

- Upcoming Closing Dates -

- Your {{ newTerminologyEnabled ? 'team' : 'agency' }} has no upcoming close dates. -
- -
- - - - See All Upcoming - - - -
-
-
@@ -95,11 +57,10 @@ import { mapActions, mapGetters } from 'vuex'; import resizableTableMixin from '@/mixin/resizableTable'; import GrantDetailsLegacy from '@/components/Modals/GrantDetailsLegacy.vue'; import ActivityTable from '@/components/ActivityTable.vue'; -import ClosingDatesTable from '@/components/ClosingDatesTable.vue'; import { newTerminologyEnabled, newGrantsDetailPageEnabled } from '@/helpers/featureFlags'; export default { - components: { ClosingDatesTable, ActivityTable, GrantDetailsLegacy }, + components: { ActivityTable, GrantDetailsLegacy }, mixins: [resizableTableMixin], data() { return { @@ -112,9 +73,7 @@ export default { computed: { ...mapGetters({ totalInterestedGrants: 'grants/totalInterestedGrants', - totalUpcomingGrants: 'grants/totalUpcomingGrants', selectedTeam: 'users/selectedAgency', - closestGrants: 'grants/closestGrants', grantsInterested: 'grants/grantsInterested', currentGrant: 'grants/currentGrant', }), @@ -132,7 +91,6 @@ export default { async selectedGrant() { if (!this.selectedGrant) { await this.fetchGrantsInterested(); - await this.fetchClosestGrants(); } }, currentGrant() { @@ -148,11 +106,9 @@ export default { ...mapActions({ fetchGrantsInterested: 'grants/fetchGrantsInterested', fetchGrantDetails: 'grants/fetchGrantDetails', - fetchClosestGrants: 'grants/fetchClosestGrants', }), async setup() { this.fetchGrantsInterested({ perPage: this.perPage, currentPage: this.currentPage }); - this.fetchClosestGrants({ perPage: this.perPageClosest, currentPage: this.currentPage }); }, async onRowSelected(items) { const [row] = items; @@ -178,11 +134,6 @@ export default { margin-top: -8px; margin-bottom: -6px; } - .gutter-upcoming.row { - margin-left: -2px; - margin-top: -8px; - margin-bottom: -6px; - } .gutter-title1.row { margin-left: +4px; } diff --git a/packages/client/src/views/UpcomingClosingDatesView.spec.js b/packages/client/src/views/UpcomingClosingDatesView.spec.js deleted file mode 100644 index 03404211e..000000000 --- a/packages/client/src/views/UpcomingClosingDatesView.spec.js +++ /dev/null @@ -1,45 +0,0 @@ -import UpcomingClosingDatesView from '@/views/UpcomingClosingDatesView.vue'; - -import { - describe, it, expect, vi, -} from 'vitest'; -import { shallowMount, createLocalVue } from '@vue/test-utils'; -import Vuex from 'vuex'; -import { BootstrapVue } from 'bootstrap-vue'; - -vi.mock('@/helpers/featureFlags', async (importOriginal) => ({ - ...await importOriginal(), - newGrantsDetailPageEnabled: () => true, -})); - -describe('UpcomingClosingDatesView', () => { - const localVue = createLocalVue(); - localVue.use(Vuex); - localVue.use(BootstrapVue); - const store = new Vuex.Store({ - getters: { - 'grants/currentGrant': () => {}, - 'grants/totalUpcomingGrants': () => null, - 'users/selectedAgency': () => {}, - 'grants/closestGrants': () => [], - }, - actions: { - 'grants/fetchGrantDetails': vi.fn(), - 'grants/fetchClosestGrants': vi.fn(), - }, - }); - const $route = { - query: {}, - }; - - it('renders', () => { - const wrapper = shallowMount(UpcomingClosingDatesView, { - localVue, - store, - mocks: { - $route, - }, - }); - expect(wrapper.exists()).toBe(true); - }); -}); diff --git a/packages/client/src/views/UpcomingClosingDatesView.vue b/packages/client/src/views/UpcomingClosingDatesView.vue deleted file mode 100644 index 1e58a6ce9..000000000 --- a/packages/client/src/views/UpcomingClosingDatesView.vue +++ /dev/null @@ -1,129 +0,0 @@ - - - - diff --git a/packages/server/__tests__/db/db.test.js b/packages/server/__tests__/db/db.test.js index 4124bc5e0..f14b23f26 100644 --- a/packages/server/__tests__/db/db.test.js +++ b/packages/server/__tests__/db/db.test.js @@ -315,20 +315,6 @@ describe('db', () => { }); }); - context('getClosestGrant', () => { - it('gets closest grants', async () => { - const searchTimestamp = new Date('2021-11-02'); - const result = await db.getClosestGrants({ - agency: 0, - perPage: 10, - currentPage: 1, - timestampForTest: searchTimestamp, - }); - expect(result.data.length).to.equal(2); - expect(result.data[0].grant_id).to.equal('1'); - }); - }); - context('getAgencyCriteriaForAgency', () => { it('gets agency criteria associated with an agency', async () => { const staffUserId = await db.knex(TABLES.users).where('email', fixtures.users.staffUser.email); diff --git a/packages/server/src/db/index.js b/packages/server/src/db/index.js index c858f5210..67d4dda58 100755 --- a/packages/server/src/db/index.js +++ b/packages/server/src/db/index.js @@ -1019,25 +1019,6 @@ async function getSingleGrantDetails({ grantId, tenantId }) { return enhancedResults.length ? enhancedResults[0] : null; } -async function getClosestGrants({ - agency, perPage, currentPage, timestampForTest, -}) { - const agencies = await getAgencyTree(agency); - - // updated to no longer limit result # & specify user association - const timestamp = (timestampForTest || new Date()).toLocaleDateString('en-US'); - return knex(TABLES.grants_interested) - .select('grants.title', 'grants.close_date', 'grants.grant_id') - .join('grants', 'grants.grant_id', 'grants_interested.grant_id') - .join('interested_codes', 'grants_interested.interested_code_id', 'interested_codes.id') - .whereIn('grants_interested.agency_id', agencies.map((a) => a.id)) - .andWhere('close_date', '>=', timestamp) - .andWhere('interested_codes.status_code', '!=', 'Rejected') - .groupBy('grants.title', 'grants.close_date', 'grants.grant_id') - .orderBy('close_date', 'asc') - .paginate({ currentPage, perPage, isLengthAware: true }); -} - async function markGrantAsViewed({ grantId, agencyId, userId }) { return knex(TABLES.grants_viewed) .insert({ @@ -1679,7 +1660,6 @@ module.exports = { buildOrderingParams, getNewGrantsForAgency, getSingleGrantDetails, - getClosestGrants, getGrant, markGrantAsViewed, getInterestedAgencies, diff --git a/packages/server/src/routes/grants.js b/packages/server/src/routes/grants.js index b490b0bce..09b9d0435 100755 --- a/packages/server/src/routes/grants.js +++ b/packages/server/src/routes/grants.js @@ -1,7 +1,6 @@ const express = require('express'); // eslint-disable-next-line import/no-unresolved const { stringify: csvStringify } = require('csv-stringify/sync'); -const groupBy = require('lodash/groupBy'); const db = require('../db'); const email = require('../lib/email'); const { requireUser, isUserAuthorized } = require('../lib/access-helpers'); @@ -101,24 +100,6 @@ router.get('/:grantId/grantDetails', requireUser, async (req, res) => { res.json(response); }); -router.get('/closestGrants/:perPage/:currentPage', requireUser, async (req, res) => { - const { perPage, currentPage } = req.params; - const { data, pagination } = await db.getClosestGrants({ agency: req.session.selectedAgency, perPage, currentPage }); - - // Get interested agencies for each grant - const grantIds = data.map((grant) => grant.grant_id); - const agencies = await db.getInterestedAgencies({ grantIds, tenantId: req.session.user.tenant_id }); - const agenciesByGrantId = groupBy(agencies, 'grant_id'); - const enhancedData = data.map((grant) => ( - { - ...grant, - interested_agencies: (agenciesByGrantId[grant.grant_id] || []).map((agency) => agency.agency_abbreviation || agency.agency_name), - } - )); - - res.json({ data: enhancedData, pagination }); -}); - // For API tests, reduce the limit to 100 -- this is so we can test the logic around the limit // without the test having to insert 500 rows, which slows down the test. const MAX_CSV_EXPORT_ROWS = process.env.NODE_ENV !== 'test' ? 500 : 100;