-
Notifications
You must be signed in to change notification settings - Fork 89
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
bla #66
base: master
Are you sure you want to change the base?
bla #66
Conversation
self.check_input('image') | ||
image = self.input['image'][0] | ||
try: | ||
f = open("static/img/activityImage/" + image.name, "wb") |
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.
如果创建的多个活动的图片有相同的文件名,后面的图片会覆盖之前的图片文件,导致前一个活动图片丢失。
我认为不应该用图片名直接作为服务器保存的文件名,而应该想办法生成一个unique id。
id = self.input['id'] | ||
try: | ||
activity = Activity.objects.get(id=id) | ||
activity.id = self.input['id'] |
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.
感觉这一行多余,而且手动改数据库id很危险
activity.total_tickets = self.input['totalTickets'] | ||
activity.status = self.input['status'] | ||
|
||
activity.save() |
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.
修改活动详情有很多限制,如活动开始后不能修改抢票时间之类的,这里没有找到相关功能的代码。
activity_ids.append(int(activity_id)) | ||
acts = Activity.objects.filter( | ||
id__in=activity_ids, status=Activity.STATUS_PUBLISHED, book_end__gt=timezone.now() | ||
).order_by('book_end')[: 5] |
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.
为啥要order_by book_end,这样可能得到的顺序和抢票菜单里的真实顺序不一样。
raise ValidateError("Activity for this ID does not exit!") | ||
try: | ||
T = Ticket.objects.filter(activity=activity, student_id=studentId) | ||
for t in T: |
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.
for循环是一个活动一个学号会有多张票吗?感觉逻辑有点怪
No description provided.