groton-school / course-planning-tool

Course planning tool to distribute individual Google Sheet course plans to students and advisors based on Blackbaud registration data
GNU General Public License v3.0
0 stars 0 forks source link

Unsafely assumes column order #100

Open github-actions[bot] opened 1 year ago

github-actions[bot] commented 1 year ago

https://api.github.com/groton-school/course-planning-tool/blob/f7dba7560c6c717c0fa535e6e5c9bbabc0dd779f/src/Role/Advisor.ts#L94


    ).find(([id]) => id === hostId);
    let student: Student;
    if (row) {
      const [
        // FIXME unsafely assumes column order
        hostId,
        email,
        firstName,
        lastName,
        gradYear,
        advisorEmail,
        advisorFirstName,
        advisorLastName
      ] = row;
      student = new Student({
        hostId,
        email,
        firstName,
        lastName,
        gradYear,
        previousAdvisor: {
          email: advisorEmail,
          firstName: advisorFirstName,
          lastName: advisorLastName
        }
      });
    }
    return student;
  }
battis commented 11 months ago

Also include Student object in this, per #101

battis commented 10 months ago

Mayhap make use of/expand existing constants?

battis commented 6 months ago

Current theory: introduce a build step that creates a JSON model of the actual Sheet, which would then trigger TypeScript errors on compile if bad assumptions were made. Should probably be abstracted out of this project into @battis/gas-lighter or @battis/partly-gcloudy for reuse.