Photos: Rename maintained_at to checked_at
Signed-off-by: Michael Mayer <michael@liquidbytes.net>
This commit is contained in:
parent
9a07c0506e
commit
43abf0bd83
7 changed files with 18 additions and 16 deletions
|
@ -122,10 +122,10 @@
|
|||
{{ model.EditedAt | luxon:format('http') }}
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-if="model.MaintainedAt">
|
||||
<td><translate key="Maintained">Maintained</translate></td>
|
||||
<tr v-if="model.CheckedAt">
|
||||
<td><translate key="Checked">Checked</translate></td>
|
||||
<td>
|
||||
{{ model.MaintainedAt | luxon:format('http') }}
|
||||
{{ model.CheckedAt | luxon:format('http') }}
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-if="model.DeletedAt">
|
||||
|
|
|
@ -115,9 +115,9 @@ export class Photo extends RestModel {
|
|||
// Date fields.
|
||||
CreatedAt: "",
|
||||
UpdatedAt: "",
|
||||
DeletedAt: null,
|
||||
EditedAt: null,
|
||||
MaintainedAt: null,
|
||||
CheckedAt: null,
|
||||
DeletedAt: null,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -82,7 +82,7 @@ type Photo struct {
|
|||
CreatedAt time.Time `yaml:"CreatedAt,omitempty"`
|
||||
UpdatedAt time.Time `yaml:"UpdatedAt,omitempty"`
|
||||
EditedAt *time.Time `yaml:"EditedAt,omitempty"`
|
||||
MaintainedAt *time.Time `sql:"index" yaml:"-"`
|
||||
CheckedAt *time.Time `sql:"index" yaml:"-"`
|
||||
DeletedAt *time.Time `sql:"index" yaml:"DeletedAt,omitempty"`
|
||||
}
|
||||
|
||||
|
|
|
@ -98,8 +98,8 @@ func (m *Photo) Maintain() error {
|
|||
return errors.New("photo: can't maintain, id is empty")
|
||||
}
|
||||
|
||||
maintained := time.Now()
|
||||
m.MaintainedAt = &maintained
|
||||
checked := time.Now()
|
||||
m.CheckedAt = &checked
|
||||
|
||||
m.EstimatePlace()
|
||||
|
||||
|
|
|
@ -90,8 +90,8 @@ func ResetPhotoQuality() error {
|
|||
Update("photo_quality", -1).Error
|
||||
}
|
||||
|
||||
// PhotosMaintenance returns photos selected for maintenance.
|
||||
func PhotosMaintenance(limit int, offset int) (entities entity.Photos, err error) {
|
||||
// PhotosCheck returns photos selected for maintenance.
|
||||
func PhotosCheck(limit int, offset int) (entities entity.Photos, err error) {
|
||||
err = Db().
|
||||
Preload("Labels", func(db *gorm.DB) *gorm.DB {
|
||||
return db.Order("photos_labels.uncertainty ASC, photos_labels.label_id DESC")
|
||||
|
@ -103,7 +103,7 @@ func PhotosMaintenance(limit int, offset int) (entities entity.Photos, err error
|
|||
Preload("Place").
|
||||
Preload("Location").
|
||||
Preload("Location.Place").
|
||||
Where("maintained_at IS NULL OR maintained_at < ?", time.Now().Add(-1*time.Hour*24*3)).
|
||||
Where("checked_at IS NULL OR checked_at < ?", time.Now().Add(-1*time.Hour*24*3)).
|
||||
Where("updated_at < ?", time.Now().Add(-1*time.Minute*10)).
|
||||
Limit(limit).Offset(offset).Find(&entities).Error
|
||||
|
||||
|
|
|
@ -81,6 +81,8 @@ type PhotoResult struct {
|
|||
Merged bool `json:"Merged"`
|
||||
CreatedAt time.Time `json:"CreatedAt"`
|
||||
UpdatedAt time.Time `json:"UpdatedAt"`
|
||||
EditedAt time.Time `json:"EditedAt,omitempty"`
|
||||
CheckedAt time.Time `json:"CheckedAt,omitempty"`
|
||||
DeletedAt time.Time `json:"DeletedAt,omitempty"`
|
||||
|
||||
Files []entity.File `json:"Files"`
|
||||
|
|
|
@ -62,7 +62,7 @@ func (worker *Prism) Start() (err error) {
|
|||
offset := 0
|
||||
|
||||
for {
|
||||
photos, err := query.PhotosMaintenance(limit, offset)
|
||||
photos, err := query.PhotosCheck(limit, offset)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -71,12 +71,12 @@ func (worker *Prism) Start() (err error) {
|
|||
if len(photos) == 0 {
|
||||
break
|
||||
} else if offset == 0 {
|
||||
log.Infof("prism: starting metadata optimization")
|
||||
log.Infof("prism: starting routine check")
|
||||
}
|
||||
|
||||
for _, photo := range photos {
|
||||
if mutex.PrismWorker.Canceled() {
|
||||
return errors.New("prism: optimization canceled")
|
||||
return errors.New("prism: check canceled")
|
||||
}
|
||||
|
||||
if done[photo.PhotoUID] {
|
||||
|
@ -89,7 +89,7 @@ func (worker *Prism) Start() (err error) {
|
|||
}
|
||||
|
||||
if mutex.PrismWorker.Canceled() {
|
||||
return errors.New("prism: optimization canceled")
|
||||
return errors.New("prism: check canceled")
|
||||
}
|
||||
|
||||
offset += limit
|
||||
|
@ -98,7 +98,7 @@ func (worker *Prism) Start() (err error) {
|
|||
}
|
||||
|
||||
if len(done) > 0 {
|
||||
log.Infof("prism: optimized %d photos", len(done))
|
||||
log.Infof("prism: checked %d photos", len(done))
|
||||
}
|
||||
|
||||
worker.logError(query.ResetPhotoQuality())
|
||||
|
|
Loading…
Reference in a new issue