implemented job archiving (via a Setting, and just viewing recent or all)
This commit is contained in:
@@ -37,9 +37,10 @@ class Settings(db.Model):
|
||||
scheduled_storage_scan = db.Column(db.Integer)
|
||||
scheduled_bin_cleanup = db.Column(db.Integer)
|
||||
bin_cleanup_file_age = db.Column(db.Integer)
|
||||
job_archive_age = db.Column(db.Integer)
|
||||
|
||||
def __repr__(self):
|
||||
return f"<id: {self.id}, import_path: {self.import_path}, storage_path: {self.storage_path}, recycle_bin_path: {self.recycle_bin_path}, default_refimg_model: {self.default_refimg_model}, default_scan_model: {self.default_scan_model}, default_threshold: {self.default_threshold}, scheduled_import_scan:{self.scheduled_import_scan}, scheduled_storage_scan: {self.scheduled_storage_scan}, scheduled_bin_cleanup: {Self.scheduled_bin_cleanup}, bin_cleanup_file_age: {self.bin_cleanup_file_age} >"
|
||||
return f"<id: {self.id}, import_path: {self.import_path}, storage_path: {self.storage_path}, recycle_bin_path: {self.recycle_bin_path}, default_refimg_model: {self.default_refimg_model}, default_scan_model: {self.default_scan_model}, default_threshold: {self.default_threshold}, scheduled_import_scan:{self.scheduled_import_scan}, scheduled_storage_scan: {self.scheduled_storage_scan}, scheduled_bin_cleanup: {self.scheduled_bin_cleanup}, bin_cleanup_file_age: {self.bin_cleanup_file_age}, job_archive_age: {self.job_archive_age}>"
|
||||
|
||||
################################################################################
|
||||
# Helper class that inherits a .dump() method to turn class Settings into json / useful in jinja2
|
||||
@@ -68,6 +69,7 @@ class SettingsForm(FlaskForm):
|
||||
scheduled_storage_scan = IntegerField('Days between forced scan of storage path', [validators.DataRequired()])
|
||||
scheduled_bin_cleanup = IntegerField('Days between checking to clean Recycle Bin:', [validators.DataRequired()])
|
||||
bin_cleanup_file_age = IntegerField('Age of files to clean out of the Recycle Bin', [validators.DataRequired()])
|
||||
job_archive_age = IntegerField('Age of jobs to archive', [validators.DataRequired()])
|
||||
submit = SubmitField('Save' )
|
||||
|
||||
################################################################################
|
||||
@@ -90,6 +92,7 @@ def settings():
|
||||
HELP['scheduled_storage_scan']="The # of days between forced scans of the storage path for any file system changes outside of Photo Assistant"
|
||||
HELP['scheduled_bin_cleanup']="The # of days between running a job to delete old files from the Recycle Bin"
|
||||
HELP['bin_cleanup_file_age']="The # of days a file has to exist in the Recycle Bin before it can be really deleted"
|
||||
HELP['job_archive_age']="The # of days a job has to exist for to be archived"
|
||||
|
||||
if request.method == 'POST' and form.validate():
|
||||
try:
|
||||
@@ -110,6 +113,7 @@ def settings():
|
||||
s.scheduled_storage_scan = request.form['scheduled_storage_scan']
|
||||
s.scheduled_bin_cleanup = request.form['scheduled_bin_cleanup']
|
||||
s.bin_cleanup_file_age = request.form['bin_cleanup_file_age']
|
||||
s.job_archive_age = request.form['job_archive_age']
|
||||
db.session.commit()
|
||||
return redirect( url_for( 'settings' ) )
|
||||
except SQLAlchemyError as e:
|
||||
|
||||
Reference in New Issue
Block a user