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

Timestamp for PersonImage #2413

Merged
merged 1 commit into from
Jul 16, 2024
Merged

Conversation

VirginiaDooley
Copy link
Contributor

@VirginiaDooley VirginiaDooley commented Jul 2, 2024

This work

  • changes the PersonImage to a TimeStampedModel
  • add a migration with default timestamps for created and updated which takes data from last queued image to populate existing PersonImage instances.
  • renders the timestamp in the template to help users decide if a photo should be updated (very recent photos may not need updating at all)
    Screenshot 2024-07-02 at 4 50 31 PM

These changes will also lay the groundwork for a more straightforward approach to refactoring #2386


@VirginiaDooley VirginiaDooley force-pushed the hotfix/person-image-timestamp branch from 7f38c4d to 7728dff Compare July 2, 2024 15:14
@VirginiaDooley VirginiaDooley requested a review from symroe July 2, 2024 15:14
@VirginiaDooley VirginiaDooley changed the title Record a timestamp on PersonImage Timestamp context for PersonImage and new uploads Jul 2, 2024
@VirginiaDooley VirginiaDooley changed the title Timestamp context for PersonImage and new uploads Timestamp for PersonImage Jul 2, 2024
)
modified = pi.modified
response = self.app.get(f"/person/{person.id}", user=self.user)
self.assertIn(
Copy link
Contributor Author

@VirginiaDooley VirginiaDooley Jul 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BST problems? I tried this again with freeze_time and also changed the migration update and created default to datetime.now(timezone.utc).isoformat() but got the same error.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this working now? CI seems ok?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I don't think so - it's a mismatch in the time.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've pushed a commit that fixes this, but I'm a little confused as to why we're not getting the right timezone back from pi.modified. In my understanding, the model should store the timezone and return local time, but maybe that's not how it works.

- Show the last updated timestamp for PersonImage
- Test migration and template for PersonImage timestamps
- Fix timezone
@VirginiaDooley VirginiaDooley force-pushed the hotfix/person-image-timestamp branch from b1eaeab to 057af63 Compare July 16, 2024 09:44
@VirginiaDooley VirginiaDooley merged commit a6b5d99 into master Jul 16, 2024
5 checks passed
Copy link

sentry-io bot commented Jul 16, 2024

Suspect Issues

This pull request was deployed and Sentry observed the following issues:

  • ‼️ AttributeError: 'NoneType' object has no attribute 'updated' people.migrations.0047_alter_personimage_option... View Issue

Did you find this useful? React with a 👍 or 👎

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants