Skip to content

Commit

Permalink
Relax hydratePerson due to #151
Browse files Browse the repository at this point in the history
  • Loading branch information
reivilibre committed Jan 13, 2023
1 parent d46f0f2 commit 366c6e1
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/backends/penta/PentaBackend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { AuditoriumId, InterestId, IScheduleBackend, TalkId } from "../ISchedule
import { PentaDb } from "./db/PentaDb";
import { PentabarfParser } from "./PentabarfParser";
import * as fetch from "node-fetch";
import { LogService } from "matrix-bot-sdk";


export class PentaBackend implements IScheduleBackend {
Expand Down Expand Up @@ -80,10 +81,10 @@ export class PentaBackend implements IScheduleBackend {
const dbPeople = await this.db.findPeopleWithId(person.id);
if (dbPeople.length == 0) return;

if (dbPeople.length > 1) {
throw new Error(`Person ID '${person.id}' has ${dbPeople.length} different people associated with it!`);
}

// Multiple people may be returned by this query.
// See https://github.com/matrix-org/conference-bot/issues/151
// In the future, would be nice to throw an exception:
// `Person ID '${person.id}' has ${dbPeople.length} different people associated with it!`
const dbPerson = dbPeople[0];
person.matrix_id = dbPerson.matrix_id;
person.email = dbPerson.email;
Expand Down

0 comments on commit 366c6e1

Please sign in to comment.