elekto-io/elekto

Candidates should look up by ID, not filename

Opened this issue · 0 comments

Currently how candidates are looked up for display is this:

        path = os.path.join(self.path, 'candidate-{}.md'.format(cid))

This means that, for candidates to display correctly, the ID in the file and the 2nd half of the filename must match exactly. This is error-prone.

Since we have a dictionary that has the full list of candidates in it, we should look up candidates by ID and then find the correct filename from that. That way, the file can be named whatever as long as it starts with "candidate-".

Putting this as a TODO, since I need to fix one other issue about how candidates display and I'll probably do them both at once.