Skip to content

Commit

Permalink
removed debugger logging, updated error copy
Browse files Browse the repository at this point in the history
  • Loading branch information
horatiorosa committed Jan 23, 2025
1 parent f234efe commit ce089cb
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 38 deletions.
12 changes: 6 additions & 6 deletions client/app/components/projects/new.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,7 @@
disabled={{or (not saveableProjectsNewForm.isSubmittable) this.submissionError this.isSubmitting}}
@continueButtonTitle="Continue Editing" data-test-confirm-submit-button={{true}}>
<h6>Confirm New Project Submission</h6>
{{#if this.submissionError}}
<div class="grid-x medium-padding-top medium-padding-bottom">
<p class="header-large medium-marin-top small-margin-bottom">Error while creating project. Lorem Ipsum.....</p>
</div>
{{else}}

<p class="header-large medium-margin-top small-margin-bottom">
Are you sure?
</p>
Expand All @@ -69,7 +65,11 @@
Please refresh your browser if you do not immediately see your project under the Other Projects section of the home
page.
</p>
{{/if}}
{{#if this.submissionError}}
<div class="grid-x medium-padding-top medium-padding-bottom">
<p class="header-large medium-marin-top small-margin-bottom">An error may have occurred while creating project</p>
</div>
{{/if}}
</saveableProjectsNewForm.ConfirmationModal>
</div>
</div>
Expand Down
8 changes: 0 additions & 8 deletions client/app/components/projects/new.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ export default class ProjectsNewFormComponent extends Component {
@tracked
isSubmitting = false;

requestCounter = 0;

@service
router;

Expand All @@ -39,9 +37,6 @@ export default class ProjectsNewFormComponent extends Component {
this.submissionError = false;
if (this.isSubmitting) return;
this.isSubmitting = true;
const requestStartTime = Date.now();
this.requestCounter++;
console.log(`LOGGER: [Total Requests Made in the client controller] ${this.requestCounter}`);

const primaryContactInput = {
first: this.args.package.primaryContactFirstName,
Expand Down Expand Up @@ -131,9 +126,6 @@ export default class ProjectsNewFormComponent extends Component {
}),
});
const { data: project } = await response.json();
const requestEndTime = Date.now();
console.debug(`LOGGER: POST request in the client controller to took ${requestEndTime - requestStartTime} ms`);
console.debug('response in client controller: ', response, 'response status: ', response.status);

const artifactsId = project.attributes['dcp-artifactsid'];
if (artifactsId === undefined) {
Expand Down
4 changes: 4 additions & 0 deletions client/app/routes/projects/new.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ export default class ProjectsNewRoute extends Route.extend(
async model() {
const projectsNewForm = this.store.createRecord('project-new');

/*
We need to create a pseudo project id in order to enable document attachments within the new projects form.
The actual project id will be assigned after the form is submitted to the CRM
*/
projectsNewForm.id = `new${self.crypto.randomUUID()}`;
projectsNewForm.createFileQueue();

Expand Down
12 changes: 2 additions & 10 deletions server/src/crm/crm.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ export class CrmService {
crmUrlPath = '';
crmHost = '';
host = '';
requestCounter = 0;

constructor(private readonly config: ConfigService) {
ADAL.ADAL_CONFIG = {
Expand Down Expand Up @@ -64,19 +63,12 @@ export class CrmService {

async create(query, data, headers = {}) {
try {
console.debug(
"LOGGER CRM create query", query,
"LOGGER CRM create data", data,
"LOGGER CRM create headers", headers,
);
const requestStartTime = Date.now();
const response = this._create(query, data, headers);
const requestEndTime = Date.now();
console.debug(`LOGGER: LOGGER CRM create request took ${requestEndTime - requestStartTime} ms`);

return response;

} catch (e) {
console.debug(`LOGGER error in CRM create: ${e}`);
console.debug(`error in CRM create: ${e}`);
}
}

Expand Down
6 changes: 0 additions & 6 deletions server/src/projects/projects.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ import { AuthorizeGuard } from 'src/authorize.guard';
@Controller('projects')
export class ProjectsController {
CRM_IMPOSTER_ID = '';
requestCounter = 0;

constructor(
private readonly projectsService: ProjectsService,
Expand Down Expand Up @@ -137,7 +136,6 @@ export class ProjectsController {
@Post('/')
@Relationships('self')
async createProject(@Body() body) {
const requestStartTime = Date.now();
const allowedAttrs = pick(body, PROJECT_ATTRS) as {
dcp_projectname: string;
dcp_borough: string;
Expand All @@ -155,10 +153,6 @@ export class ProjectsController {
HttpStatus.NOT_FOUND,
);
}
const requestEndTime = Date.now();
this.requestCounter++;
console.log(`LOGGER: [Total Requests Made in the controller] ${this.requestCounter}`)
console.debug(`LOGGER: POST request in the controller to took ${requestEndTime - requestStartTime} ms`);

return await this.projectsService.create(allowedAttrs);
}
Expand Down
9 changes: 1 addition & 8 deletions server/src/projects/projects.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ const APPLICANT_ACTIVE_STATUS_CODE = 1;
const PROJECT_ACTIVE_STATE_CODE = 0;
const PROJECT_VISIBILITY_APPLICANT_ONLY = 717170002;
const PROJECT_VISIBILITY_GENERAL_PUBLIC = 717170003;
let requestCounter = 0;

const PACKAGE_VISIBILITY = {
APPLICANT_ONLY: 717170002,
Expand Down Expand Up @@ -113,8 +112,6 @@ export class ProjectsService {
_dcp_applicantadministrator_customer_value: string;
}) {
try {
const requestStartTime = Date.now();

const data = {
dcp_projectname: attributes.dcp_projectname,
dcp_borough: attributes.dcp_borough,
Expand All @@ -135,16 +132,12 @@ export class ProjectsService {
const dcpArtifactsId = artifact['dcp_artifactsid'];
if (dcpArtifactsId === undefined) throw new Error('Failed to create artifact for project');

const requestEndTime = Date.now();
console.debug(`LOGGER: POST (service) request in the service to took ${requestEndTime - requestStartTime} ms`);
requestCounter++;
console.log(`LOGGER: [Total Requests Made in the service] ${requestCounter}`);
return {
dcp_projectid: dcpProjectId,
dcp_artifactsid: dcpArtifactsId,
};
} catch (e) {
console.error('(service) error creating project', e);
console.error('error creating project', e);
throw new HttpException(
'Unable to create project',
HttpStatus.INTERNAL_SERVER_ERROR,
Expand Down

0 comments on commit ce089cb

Please sign in to comment.