ผลต่างระหว่างรุ่นของ "418342 ภาคปลาย 2553/คะแนนและการส่งการบ้าน"
ไปยังการนำทาง
ไปยังการค้นหา
Cardcaptor (คุย | มีส่วนร่วม) |
Cardcaptor (คุย | มีส่วนร่วม) |
||
แถว 331: | แถว 331: | ||
<td align="center">50043215</td> | <td align="center">50043215</td> | ||
<td align="center">50043231</td> | <td align="center">50043231</td> | ||
+ | <td align="center">50043360</td> | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
แถว 439: | แถว 440: | ||
redirect_action = 'index' | redirect_action = 'index' | ||
end | end | ||
+ | params['post']['tags'] = tag_array | ||
+ | </geshi> | ||
+ | </td> | ||
+ | <td> | ||
+ | <geshi lang="ruby"> | ||
+ | def update | ||
+ | @post = Post.find(params[:id]) | ||
+ | buttontype = params['post']['buttontype'] | ||
+ | params['post'].delete('buttontype') | ||
+ | |||
+ | tag_array = [] | ||
+ | |||
+ | params['post']['tags'].split(',').each do |t| | ||
+ | tag = Tag.new | ||
+ | tag.name = Tag.normalize_name(t) | ||
+ | tag_array << tag | ||
+ | end | ||
+ | |||
+ | if buttontype == '1' | ||
+ | redirect_action = 'admin' | ||
+ | elsif buttontype == '2' | ||
+ | redirect_action = 'edit' | ||
+ | elsif buttontype == '3' | ||
+ | params['post']['published_at'] = Time.now.getutc | ||
+ | redirect_action = 'index' | ||
+ | end | ||
+ | |||
params['post']['tags'] = tag_array | params['post']['tags'] = tag_array | ||
</geshi> | </geshi> |
รุ่นแก้ไขเมื่อ 00:16, 20 มีนาคม 2554
เนื้อหา
การส่งงาน
รหัสประจำตัว | การบ้าน 1 | การบ้าน 2 | การบ้าน 3 |
50040229 | ส่งแล้ว | ส่งแล้ว | ส่งแล้ว |
50042993 | ส่งแล้ว | ส่งแล้ว | ส่งแล้ว |
50043058 | ส่งแล้ว | ส่งแล้ว | ส่งแล้ว |
50043082 | ส่งแล้ว | ส่งแล้ว | ส่งแล้ว |
50043140 | ส่งแล้ว | ส่งแล้ว | ส่งแล้ว |
50043173 | ส่งแล้ว | ส่งแล้ว | ส่งแล้ว |
50043215 | ส่งแล้ว | ส่งแล้ว | ส่งแล้ว |
50043231 | ส่งแล้ว | ส่งแล้ว | ส่งแล้ว |
50043306 | ส่งแล้ว | ส่งแล้ว | ส่งแล้ว |
51043214 | ส่งแล้ว | ||
50180249 | |||
51180198 | ส่งแล้ว | ส่งแล้ว | ส่งแล้ว |
51180503 | ส่งแล้ว | ส่งแล้ว |
คะแนนการบ้าน 1
รหัสประจำตัว | A (20) | B (20) | C (20) | D (20) | E (20) | รวม | หมายเหตุ | ||
50040229 | 30 | 10 | 10 | 10 | 10 | 0 | 0 | 70 |
|
50042993 | 30 | 10 | 2 | 10 | 0 | 0 | 0 | 52 |
|
50043058 | 30 | 10 | 10 | 10 | 0 | 0 | 0 | 60 |
|
50043082 | 30 | 10 | 10 | 20 | 10 | 10 | 10 | 100 | |
50043140 | 30 | 10 | 10 | 10 | 10 | 10 | 10 | 90 |
|
50043173 | 30 | 10 | 10 | 20 | 10 | 0 | 0 | 80 |
|
50043215 | 30 | 10 | 10 | 10 | 10 | 0 | 0 | 70 |
|
50043231 | 30 | 8 | 2 | 10 | 10 | 10 | 10 | 80 |
|
50043306 | 30 | 10 | 10 | 10 | 10 | 10 | 10 | 90 |
|
51043214 | |||||||||
50180249 | |||||||||
51180198 | 30 | 10 | 10 | 10 | 10 | 10 | 10 | 90 |
|
51180503 |
เกณฑ์การให้คะแนน
- A: migration รันผ่าน (30)
- B: จำนวนฟีลด์ (10)
- C: จำนวน record (10)
- D: หน้า search สามารถแสดงข้อมูลได้เมื่อไม่ใส่ข้อมูล search อะไรเลย (20)
- E: Search ฟีลด์ 1 (10)
- F: Search ฟีลด์ 2 (10)
- G: Search ฟีลด์ 3 (10)
คะแนนการบ้าน 3
ฟังก์ชัน update ใน app/controllers/posts_controller.rb (Pattern 1)
50042993 | 50043082 | 50043215 | 50043231 | 50043360 |
<geshi lang="ruby"> def update @post = Post.find(params[:id]) type = params['post']['buttonType'] params['post'].delete('buttonType') tags = params['post']['tags'] arrayTag = [] tags.split(',').each do |tag| t = Tag.new t.name = Tag.normalize_name(tag) arrayTag << t end params['post']['tags'] = arrayTag if type == '1' redirect_action = 'admin' elsif type == '2' redirect_action = 'edit' elsif type == '3' params['post']['published_at'] = Time.now.getutc redirect_action = 'index' end </geshi> |
<geshi lang="ruby"> def update @post = Post.find(params[:id]) buttontype = params['post']['buttontype'] params['post'].delete('buttontype') tag_array = [] params['post']['tags'].split(',').each do |t| tag = Tag.new tag.name = Tag.normalize_name(t) tag_array << tag end if buttontype == '1' redirect_action = 'admin' elsif buttontype == '2' redirect_action = 'edit' elsif buttontype == '3' params['post']['published_at'] = Time.now.getutc redirect_action = 'index' end params['post']['tags'] = tag_array </geshi> |
<geshi lang="ruby"> def update @post = Post.find(params[:id]) type = params['post']['buttonType'] params['post'].delete('buttonType') tags = params['post']['tags'] arrayTag = [] tags.split(',').each do |tag| t = Tag.new t.name = Tag.normalize_name(tag) arrayTag << t end params['post']['tags'] = arrayTag if type == '1' redirect_action = 'admin' elsif type == '2' redirect_action = 'edit' elsif type == '3' params['post']['published_at'] = Time.now.getutc redirect_action = 'index' end </geshi> |
<geshi lang="ruby"> def update @post = Post.find(params[:id]) type = params['post']['buttontype'] params['post'].delete('buttontype') tag_array = [] params['post']['tags'].split(',').each do |t| tag = Tag.new tag.name = Tag.normalize_name(t) tag_array << tag end if type == '1' redirect_action = 'admin' elsif type == '2' redirect_action = 'edit' elsif type == '3' params['post']['published_at'] = Time.now.getutc redirect_action = 'index' end params['post']['tags'] = tag_array </geshi> |
<geshi lang="ruby"> def update @post = Post.find(params[:id]) buttontype = params['post']['buttontype'] params['post'].delete('buttontype') tag_array = [] params['post']['tags'].split(',').each do |t| tag = Tag.new tag.name = Tag.normalize_name(t) tag_array << tag end if buttontype == '1' redirect_action = 'admin' elsif buttontype == '2' redirect_action = 'edit' elsif buttontype == '3' params['post']['published_at'] = Time.now.getutc redirect_action = 'index' end params['post']['tags'] = tag_array </geshi> |
ฟังก์ชัน update ใน app/controllers/posts_controller.rb (Pattern 2)
50040229 | 50043140 |
<geshi lang="ruby"> def update @post = Post.find(params[:id]) buttontype = params['post']['buttontype'] params['post'].delete('buttontype') tag_array = [] for t in params['post']['tags'].split(',') tag = Tag.new tag.name = Tag.normalize_name(t) tag_array << tag end if buttontype == '2' redirect_action = 'edit' elsif buttontype == '3' params['post']['published_at'] = Time.now.getutc redirect_action = 'index' end params['post']['tags'] = tag_array respond_to do |format| if @post.update_attributes(params[:post]) flash[:notice] = 'Post was successfully updated.' if buttontype == '1' format.html { redirect_to :action=> "admin",:id => 0 } else format.html { redirect_to :action=> redirect_action } end format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @post.errors, :status => :unprocessable_entity } end end end </geshi> |
<geshi lang="ruby"> def update @post = Post.find(params[:id]) submitmode = params['post']['submitmode'] params['post'].delete('submitmode') tag_array = [] for t in params['post']['tags'].split(',') tag = Tag.new tag.name = Tag.normalize_name(t) tag_array << tag end if submitmode == 'sc' redirect_action = 'edit' elsif submitmode == 'p' params['post']['published_at'] = Time.now.getutc redirect_action = 'index' end params['post']['tags'] = tag_array respond_to do |format| if @post.update_attributes(params[:post]) flash[:notice] = 'Post was successfully updated.' if submitmode == 's' format.html { redirect_to :action=> "admin",:id => 0 } else format.html { redirect_to :action=> redirect_action } end format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @post.errors, :status => :unprocessable_entity } end end end </geshi> |