Skip to content

Commit

Permalink
refactor: Certificate templates content (#323)
Browse files Browse the repository at this point in the history
Signed-off-by: ankita_patidar <[email protected]>
  • Loading branch information
ankita-p17 authored Dec 4, 2023
1 parent fc3f4cc commit 0ec4353
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 16 deletions.
7 changes: 3 additions & 4 deletions apps/user/templates/arbiter-template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@ export class ArbiterTemplate {

async getArbiterTemplate(attributes: Attribute[]): Promise<string> {
try {
const [name, issuedBy] = await Promise.all(attributes).then((attributes) => {
const [name] = await Promise.all(attributes).then((attributes) => {
const name = this.findAttributeByName(attributes, 'full_name')?.full_name ?? '';
const issuedBy = this.findAttributeByName(attributes, 'issued_by')?.issued_by ?? '';
return [name, issuedBy];
return [name];
});
return `<!DOCTYPE html>
<html lang="en">
Expand Down Expand Up @@ -75,7 +74,7 @@ export class ArbiterTemplate {
<span >
<p style="font-size: 16px; " >has served as an Arbiter at the
<span style="font-size: 16px; font-weight: bold;">${issuedBy} World Memory Championship 2023.</span>
<span style="font-size: 16px; font-weight: bold;">IAM World Memory Championship 2023.</span>
</p>
</p>
<p>
Expand Down
7 changes: 3 additions & 4 deletions apps/user/templates/participant-template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@ export class ParticipantTemplate {
async getParticipantTemplate(attributes: Attribute[]): Promise<string> {

try {
const [name, issuedBy] = await Promise.all(attributes).then((attributes) => {
const [name] = await Promise.all(attributes).then((attributes) => {
const name = this.findAttributeByName(attributes, 'full_name')?.full_name ?? '';
const issuedBy = this.findAttributeByName(attributes, 'issued_by')?.issued_by ?? '';
return [name, issuedBy];
return [name];
});

return `<!DOCTYPE html>
Expand Down Expand Up @@ -76,7 +75,7 @@ export class ParticipantTemplate {
margin: 15px;">${name}</p>
<span style="font-size: 16px;">for successfully participating in the
<span style="font-size: 16px; font-weight: bold; ">${issuedBy} World Memory Championship 2023.</span>
<span style="font-size: 16px; font-weight: bold; ">IAM World Memory Championship 2023.</span>
</p>
<p>
<p style="font-size: 14px; margin: 0;">We acknowledge your dedication, hard work, and</p>
Expand Down
7 changes: 3 additions & 4 deletions apps/user/templates/winner-template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,13 @@ export class WinnerTemplate {

async getWinnerTemplate(attributes: Attribute[]): Promise<string> {
try {
const [name, position, discipline, issuedBy, category] = await Promise.all(attributes).then((attributes) => {
const [name, position, discipline, category] = await Promise.all(attributes).then((attributes) => {
const name = this.findAttributeByName(attributes, 'full_name')?.full_name ?? '';
const position = this.findAttributeByName(attributes, 'position')?.position ?? '';
const discipline = this.findAttributeByName(attributes, 'discipline')?.discipline ?? '';
const issuedBy = this.findAttributeByName(attributes, 'issued_by')?.issued_by ?? '';
const category = this.findAttributeByName(attributes, 'category')?.category ?? '';
const date = this.findAttributeByName(attributes, 'issued_date')?.issued_date ?? '';
return [name, position, discipline, issuedBy, category, date];
return [name, position, discipline, category, date];
});
return `<!DOCTYPE html>
<html lang="en">
Expand Down Expand Up @@ -79,7 +78,7 @@ export class WinnerTemplate {
<p style="font-size: 16px; margin: 0;">has secured ${position} position for ${discipline} </p>
<p style="font-size: 16px; margin: 6px;">in ${category} category at the</p>
<p style="font-size: 16px;" >
<span style="font-size: 16px; font-weight: bold;"> ${issuedBy} World Memory Championship 2023.</span>
<span style="font-size: 16px; font-weight: bold;">IAM World Memory Championship 2023.</span>
</p>
</p>
<p>
Expand Down
7 changes: 3 additions & 4 deletions apps/user/templates/world-record-template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@ export class WorldRecordTemplate {

async getWorldRecordTemplate(attributes: Attribute[]): Promise<string> {
try {
const [name, discipline, issuedBy] = await Promise.all(attributes).then((attributes) => {
const [name, discipline] = await Promise.all(attributes).then((attributes) => {
const name = this.findAttributeByName(attributes, 'full_name')?.full_name ?? '';
const discipline = this.findAttributeByName(attributes, 'discipline')?.discipline ?? '';
const issuedBy = this.findAttributeByName(attributes, 'issued_by')?.issued_by ?? '';
return [name, discipline, issuedBy];
return [name, discipline];
});
return `<!DOCTYPE html>
<html lang="en">
Expand Down Expand Up @@ -77,7 +76,7 @@ export class WorldRecordTemplate {
<span style="font-size: 16px;">for successfully creating the world record in the
${discipline}
<p style="font-size: 16px; " >discipline during the
<span style="font-size: 16px; font-weight: bold;">${issuedBy} World Memory Championship 2023.</span>
<span style="font-size: 16px; font-weight: bold;">IAM World Memory Championship 2023.</span>
</p>
</p>
<p>
Expand Down

0 comments on commit 0ec4353

Please sign in to comment.