Skip to content

Commit e46077e

Browse files
committed
Fix: Officers images are not loading on the Officers page #235
*Changed the link code so that it finds the most recent admin year and throws an error if it fails to find an administration. *Removed the toLocalUrl function and built the image path directly inline.
1 parent 1288296 commit e46077e

1 file changed

Lines changed: 4 additions & 8 deletions

File tree

src/app/pages/officers/officers.component.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,16 @@ export class OfficersComponent {
2222
let newAdmin = this.cachedAdmins.get(year);
2323
if (!newAdmin) {
2424
// TODO: Fetch this from the back end.
25-
newAdmin = structuredClone(executives.find(e => e.startYear === year));
25+
newAdmin = structuredClone(executives.find(e => e.startYear <= year));
2626
if (!newAdmin) {
27-
// Fall back to the most recent administration if current year not found.
28-
const mostRecent = executives.reduce((latest, exec) =>
29-
exec.startYear > latest.startYear ? exec : latest
30-
);
31-
newAdmin = structuredClone(mostRecent);
27+
throw new Error(`Administration not found for any year.`);
3228
}
33-
const actualYear = newAdmin.startYear;
29+
const foundYear = newAdmin.startYear;
3430
// FIXME: Remove this once admins are properly fetched.
3531
newAdmin.members = newAdmin.members.map(exec => {
3632
return {
3733
...exec,
38-
photoName: `images/executives/${actualYear}/${exec.photoName}`
34+
photoName: `images/executives/${foundYear}/${exec.photoName}`
3935
};
4036
});
4137
// end of FIXME:

0 commit comments

Comments
 (0)