Skip to content

Commit

Permalink
fix: PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
r4zendev committed Jan 16, 2025
1 parent cbe96c0 commit f94f3fd
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 31 deletions.
5 changes: 3 additions & 2 deletions apps/backoffice-v2/src/pages/Home/Home.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,9 @@ export const Home: FunctionComponent = () => {
{/* <TabsContent value={defaultTabValue}>*/}
{/* </TabsContent>*/}
{/*</Tabs>*/}
{(isDemo || isExample) && <Outlet />}
{!isDemo && !isExample && <WelcomeCard />}
<Outlet />
{/* {(isDemo || isExample) && <Outlet />}
{!isDemo && !isExample && <WelcomeCard />} */}
</div>
</div>
);
Expand Down
42 changes: 13 additions & 29 deletions services/workflows-service/src/business/business.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import { AxiosError } from 'axios';
import { plainToClass } from 'class-transformer';
import dayjs from 'dayjs';
import { lastValueFrom } from 'rxjs';
import { z } from 'zod';
import { BusinessRepository } from './business.repository';

@Injectable()
Expand Down Expand Up @@ -71,8 +70,8 @@ export class BusinessService {
async getMerchantMonitoringMetrics({
projectIds,
features,
from,
to,
from = dayjs().startOf('month').toISOString(),
to = dayjs(from).add(1, 'month').toISOString(),
}: {
projectIds: string[];
features: TCustomerWithFeatures['features'];
Expand All @@ -83,35 +82,20 @@ export class BusinessService {
addedMerchantsCount: number;
unmonitoredMerchants: number;
}> {
// Metrics are currently mostly requested by month
if (!from) {
from = dayjs().startOf('month').toISOString();
}

if (!to) {
to = dayjs(from).add(1, 'month').toISOString();
}

const allProjectMerchants = await this.repository.findMany({}, projectIds);

const totalActiveMerchants = allProjectMerchants.filter(b => {
const disabledAt = z
.number()
.nullable()
.catch(() => null)
.parse(
(
b.metadata as {
featureConfig: Record<
(typeof FEATURE_LIST)[keyof typeof FEATURE_LIST],
TCustomerFeaturesConfig & { disabledAt: number | null | undefined }
>;
}
)?.featureConfig?.[FEATURE_LIST.ONGOING_MERCHANT_REPORT]?.disabledAt,
);
const isEnabled = (
b?.metadata as {
featureConfig: Record<
(typeof FEATURE_LIST)[keyof typeof FEATURE_LIST],
TCustomerFeaturesConfig & { disabledAt: number | null | undefined }
>;
}
)?.featureConfig?.[FEATURE_LIST.ONGOING_MERCHANT_REPORT]?.enabled;

return (
disabledAt === null ||
isEnabled ||
(b.metadata === null && features?.ONGOING_MERCHANT_REPORT?.options?.runByDefault)
);
}).length;
Expand All @@ -122,8 +106,8 @@ export class BusinessService {
OR: [
{
metadata: {
path: ['featureConfig', FEATURE_LIST.ONGOING_MERCHANT_REPORT, 'disabledAt'],
equals: Prisma.AnyNull,
path: ['featureConfig', FEATURE_LIST.ONGOING_MERCHANT_REPORT, 'enabled'],
equals: true,
},
},
features?.ONGOING_MERCHANT_REPORT?.options?.runByDefault
Expand Down

0 comments on commit f94f3fd

Please sign in to comment.