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

bla #66

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

bla #66

wants to merge 1 commit into from

Conversation

lity98
Copy link

@lity98 lity98 commented Nov 16, 2018

No description provided.

self.check_input('image')
image = self.input['image'][0]
try:
f = open("static/img/activityImage/" + image.name, "wb")
Copy link
Author

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']
Copy link
Author

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()
Copy link
Author

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]
Copy link
Author

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:
Copy link
Author

@lity98 lity98 Nov 16, 2018

Choose a reason for hiding this comment

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

for循环是一个活动一个学号会有多张票吗?感觉逻辑有点怪

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.

1 participant