Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Code health] Handle missing value when image is skipped #1583

Closed
rfontanarosa opened this issue Mar 7, 2024 · 2 comments
Closed

[Code health] Handle missing value when image is skipped #1583

rfontanarosa opened this issue Mar 7, 2024 · 2 comments
Assignees
Labels
type: code health Improvements to readability or robustness of codebase

Comments

@rfontanarosa
Copy link
Collaborator

  getFirebaseImageURLs() {
    this.tasks?.forEach(task => {
      if (task.type === this.taskType.PHOTO) {
        const submissionImage = this.getTaskSubmissionResult(task)!
          .value as string;
        const imageRef = ref(this.storage, submissionImage);
        getDownloadURL(imageRef).then(url => {
          this.firebaseURLs.set(submissionImage, url);
        });
      }
    });
  }
submission.service.ts:91 ERROR TypeError: Cannot read properties of undefined (reading 'value')
    at submission-panel.component.ts:75:68
    at List.__iterate (immutable.es.js:3338:11)
    at List.forEach (immutable.es.js:4854:17)
    at SubmissionPanelComponent.getFirebaseImageURLs (submission-panel.component.ts:73:17)
    at Object.next (submission-panel.component.ts:61:16)
    at ConsumerObserver.next (Subscriber.js:113:33)
    at Subscriber._next (Subscriber.js:80:26)
    at Subscriber.next (Subscriber.js:51:18)
    at Subject.js:69:34
    at Object.errorContext (errorContext.js:22:9)
@gino-m
Copy link
Collaborator

gino-m commented Jul 16, 2024

Instead of throwing an error we should show the "Skipped" text as we do for other values. In the near future we'll make "skipped" explicit, but for now ok to rely on null.

@nwkotto Would you like to take this one?

@gino-m gino-m assigned nwkotto and unassigned amysorto Jul 17, 2024
@nwkotto
Copy link
Contributor

nwkotto commented Jul 19, 2024

It looks like this has already been fixed. The "Take a photo" section now says "Skipped" and I see a conditional in the code for that case that isn't in what Roberto posted.
Screenshot 2024-07-19 at 2 42 46 PM

There is a separate issue, which is that sometimes there's an image url but I get an "Object ... does not exist" error and the "Take a photo" section just appears blank
Screenshot 2024-07-19 at 2 45 38 PM. Not sure if this is something the user will actually encounter, though, or it's just a messy test database.

@nwkotto nwkotto closed this as completed Jul 19, 2024
@github-project-automation github-project-automation bot moved this to Done in Ground Jul 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: code health Improvements to readability or robustness of codebase
Projects
Status: Done
Development

No branches or pull requests

5 participants