-
Notifications
You must be signed in to change notification settings - Fork 8
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
Refactor Program Management section of Admin Settings #1281
base: development
Are you sure you want to change the base?
Conversation
saving solution in route, currently get system error.
some white space and useless comments and moved some css to its proper location. Image solution still doesn't work, will ask a higher power about it on monday
file handler, was trying to use userManagement.py
except as a foreign key value in program to store one charfield variable. Add some things to hopefully handle files, not working. Updated the test data to contain added data fields.
some variables
…rrently attempting to change the file name to the name of the program along with the file extension.
…dal and the msgToast is also in front of the modal and clearly visible.
…ts still not passed FileStorage issue.
Merge branch 'refactorProgramMgmt' of github.com:BCStudentSoftwareDevTeam/celts into refactorProgramMgmt
…Team/celts into refactorProgramMgmt
For the following programs, when trying to change the event picture in settings the picture doesn't change: -Berea Teen Mentoring |
@thealphagurlux I double checked these on my machine and Anna's and we could not replicate the issue you found. |
|
I had not reset my database or restored the git branch while looking for bugs. This is what was causing the issue. |
filePaths = FileHandler(programId=programID).retrievePath(associatedAttachments) | ||
|
||
|
||
file_paths = {filename: path_info[0] for filename, path_info in filePaths.items()} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The "filePaths"
variable and the "file_paths"
variable should be both camelcase. The also should have different variable names.
fileType = file.filename.split('.')[-1] | ||
fileName = f"{self.programId}.{fileType}" | ||
AttachmentUpload.create(program=self.programId, fileName=fileName) | ||
current_programID = fileName |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be camelCase
flash("Program updated", "success") | ||
return redirect(url_for("admin.userManagement", accordion="program")) | ||
except Exception as e: | ||
print(e) | ||
flash('Error while updating program info.','warning') | ||
print("error: ", e) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Get rid of the ``"print("error: ", e)" `we don't need it.
if (single){ | ||
$(objectContainerId).html(fileHTML) | ||
} | ||
else{ | ||
msgToast("File with filename '" + file.name + "' has already been added to this event") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indentation
AttachmentUpload.create(program=self.programId, fileName=fileName) | ||
current_programID = fileName | ||
saveFileToFilesystem = current_programID | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think using snake_case for variable naming is better.
deleteFileObject
to delete_file_object.
fileType
to file_type.
fileName
to file_name.
Issue
Issue: #797
Changes
Testing
refactorProgramMgmt
./database/reset_database.sh test
flask run
app/static/files/programattachments
and make sure that there is only one file for each program (1.jpg, 2.png, etc.)git restore .