Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
ランキング実装に失敗するとこうなるという例 / Broken ranking
Search
HASEGAWA Tomoki
April 24, 2019
Technology
650
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
ランキング実装に失敗するとこうなるという例 / Broken ranking
PHP勉強会@東京 #134 の資料です。
HASEGAWA Tomoki
April 24, 2019
More Decks by HASEGAWA Tomoki
See All by HASEGAWA Tomoki
ファミコンでPHPを動かす / PHP on the Famicom side b
tomzoh
0
150
ファミコンでPHPを動かす / PHP on the Famicom
tomzoh
2
1.8k
3Dプリンタでコレはこう作る! - マルチディスプレイ用モニタアームマウンタの作り方 / Made with a 3D Printer: DIY Multi-Display Monitor Arm Mount
tomzoh
0
240
デシリアライゼーションを理解する / Inside Deserialization
tomzoh
0
1.3k
PHPer Book Revue: CPUの創りかた / How to Build a CPU
tomzoh
0
180
超入門3Dプリンタ: 生活を便利にするモノを作ろう / Getting Started with 3D Printing: Making small things that quietly improve your daily life.
tomzoh
0
110
最新ハードウェアの中の8ビットCPU / The Hidden Power of 8-Bit CPUs in Modern Hardware
tomzoh
0
440
PHPからはじめるコンピュータアーキテクチャ / From Scripts to Silicon: A Journey Through the Layers of Computing Hiroshima 2025 Edition
tomzoh
0
510
PHPからはじめるコンピュータアーキテクチャ / From Scripts to Silicon: A Journey Through the Layers of Computing
tomzoh
5
1k
Other Decks in Technology
See All in Technology
Jetson Orin Nanoとk3sとローカルLLMで音声文字起こしシステム作ってみた
y_sera15
0
120
分析の民主化を支えるメタデータ整備の実践
kakehashi
PRO
4
1.3k
実体験から学ぶ分析エージェントの開発と運⽤
recruitengineers
PRO
8
2.2k
今こそ知りたいAmplifyGen2
mkdev10
2
160
Kiro Crewをはじめよう
kizawa2020
1
150
子育てエンジニアの可処分時間が減っても成長を諦めない戦い方
sudoakiy
6
4.5k
スキマバイトという雇用形態は存在しないので、雇用期間1日のアルバイト契約を事業者とワーカーが結ぶ手続きを支えるのがタイミーなんです
akitoshiga
0
150
事業活動を AI Ready にする攻めと守りのデータエンジニアリング / data-engineering-for-ai-ready-business
pei0804
7
2.7k
Running Kotlin + Quarkus with Lambda
nealle
1
460
味覇で作るパスタが美味い - 20261001_yabaubuki.dev
livesense
PRO
0
130
ブラウザとサーバーから考えるAI時代のフロントエンド監視
shogo4131
3
870
その Valkey 使いこなしていますか?
onk
PRO
1
120
Featured
See All Featured
コードの90%をAIが書く世界で何が待っているのか / What awaits us in a world where 90% of the code is written by AI
rkaga
63
46k
Heart Work Chapter 1 - Part 1
lfama
PRO
10
37k
The Organizational Zoo: Understanding Human Behavior Agility Through Metaphoric Constructive Conversations (based on the works of Arthur Shelley, Ph.D)
kimpetersen
PRO
0
490
The #1 spot is gone: here's how to win anyway
tamaranovitovic
4
1.2k
Fashionably flexible responsive web design (full day workshop)
malarkey
409
67k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
22k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
287
14k
Testing 201, or: Great Expectations
jmmastey
46
8.3k
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
12k
Darren the Foodie - Storyboard
khoart
PRO
4
4k
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
300
Everyday Curiosity
cassininazir
0
350
Transcript
୩ஐر ϥϯΩϯά࣮ʹ ࣦഊ͢Δͱ͜͏ͳΔͱ͍͏ྫ
୩ஐر !UPN[PI
ϥΠϑϫʔΫ ςοΫΧϯϑΝϨϯεӡӦࢀՃ 8FCJ04ΞϓϦ։ൃ Ϗʔϧ $16 ϨτϩήʔϜػ ిࢠ࡞
αοΧʔ؍ઓ ϨϯλϧΧʔτϨʔε ʜ σδλϧαʔΧεגࣜձࣾ ෭ஂ$50 !UPN[PI
None
None
8FC%FWFMPQNFOUXJUI 8&"3&)*3*/( IUUQXXXEHDJSDVTDPN 0NPUFTBOEP 5PLZP
ࢿྉެ։ࡁͰ͢ !UPN[PI
ࠓͷςʔϚ
None
ϥϯΩϯά࣮ʹ ࣦഊ͢Δͱ͜͏ͳΔͱ͍͏ྫ
None
None
None
None
None
None
SELECT tmp.attendee_id, tmp.score, tmp.rank FROM ( select attendee_id, score, @c:=@c+1
rank from challenge_players where conference_id = :conference_id and challenge_id = :challenge_id order by score desc, last_scored asc ) tmp ', [ 'conference_id' => $challenge->conference_id, 'challenge_id' => $challenge->id, ]) ->fetchAll('assoc');
SELECT tmp.attendee_id, tmp.score, tmp.rank FROM ( select attendee_id, score, @c:=@c+1
rank from challenge_players where conference_id = :conference_id and challenge_id = :challenge_id order by score desc, last_scored asc ) tmp ', [ 'conference_id' => $challenge->conference_id, 'challenge_id' => $challenge->id, ]) ->fetchAll('assoc');
SELECT tmp.attendee_id, tmp.score, tmp.rank FROM ( select attendee_id, score, @c:=@c+1
rank from challenge_players where conference_id = :conference_id and challenge_id = :challenge_id order by score desc, last_scored asc ) tmp ', [ 'conference_id' => $challenge->conference_id, 'challenge_id' => $challenge->id, ]) ->fetchAll('assoc'); είΞͷ߱ॱ
SELECT tmp.attendee_id, tmp.score, tmp.rank FROM ( select attendee_id, score, @c:=@c+1
rank from challenge_players where conference_id = :conference_id and challenge_id = :challenge_id order by score desc, last_scored asc ) tmp ', [ 'conference_id' => $challenge->conference_id, 'challenge_id' => $challenge->id, ]) ->fetchAll('assoc'); είΞͷ߱ॱ
SELECT tmp.attendee_id, tmp.score, tmp.rank FROM ( select attendee_id, score, @c:=@c+1
rank from challenge_players where conference_id = :conference_id and challenge_id = :challenge_id order by score desc, last_scored asc ) tmp ', [ 'conference_id' => $challenge->conference_id, 'challenge_id' => $challenge->id, ]) ->fetchAll('assoc'); είΞͷ߱ॱ ࠷ऴείΞ֫ಘ࣌ࠁͷঢॱ
SELECT tmp.attendee_id, tmp.score, tmp.rank FROM ( select attendee_id, score, @c:=@c+1
rank from challenge_players where conference_id = :conference_id and challenge_id = :challenge_id order by score desc, last_scored asc ) tmp ', [ 'conference_id' => $challenge->conference_id, 'challenge_id' => $challenge->id, ]) ->fetchAll('assoc'); είΞͷ߱ॱ ࠷ऴείΞ֫ಘ࣌ࠁͷঢॱ ಉͳΒઌʹͦͷʹୡͨ͠ํ͕উͪ
None
͜ΕͰ ʹͳͬͨ
͜ΕͰ ʹͳͬͨ ͜ΕͰ ʹ͍͍ͨ
$challengeInputsQuery = TableRegistry::get('ChallengeInputs')->find() ->where([ 'conference_id' => $challengePlayer->conference_id, 'challenge_id' => $challengePlayer->challenge_id,
'attendee_id' => $challengePlayer->attendee_id, ]); $scoreTotal = $challengeInputsQuery ->select([ 'score_total' => $challengeInputsQuery->func()->sum('score') ]) ->first(); if (! is_null($scoreTotal->score_total)){ $challengePlayer->score = intval($scoreTotal->score_total); $challengePlayer->last_scored = new Time(); } else { $challengePlayer->score = 0; }
$challengeInputsQuery = TableRegistry::get('ChallengeInputs')->find() ->where([ 'conference_id' => $challengePlayer->conference_id, 'challenge_id' => $challengePlayer->challenge_id,
'attendee_id' => $challengePlayer->attendee_id, ]); $scoreTotal = $challengeInputsQuery ->select([ 'score_total' => $challengeInputsQuery->func()->sum('score') ]) ->first(); if (! is_null($scoreTotal->score_total)){ $challengePlayer->score = intval($scoreTotal->score_total); $challengePlayer->last_scored = new Time(); } else { $challengePlayer->score = 0; } ਖ਼ղτʔΫϯ͡Όͳͯ͘ MBTU@TDPSFEΛߋ৽ͯ͠Δʜɻ
None
ແ೦
·ͱΊ
wϥϯΩϯάείΞτʔλϧΛϨίʔυʹ ॻ͍͓͚ͯൺֱత؆୯ʹ࡞ΕΔΑɻ ·ͱΊ
wϥϯΩϯάείΞτʔλϧΛϨίʔυʹ ॻ͍͓͚ͯൺֱత؆୯ʹ࡞ΕΔΑɻ wಉ͕ൃੜͨ࣌͠ͷϩδοΫΛॻ͘ͳΒςετ ͠Α͏Ͷɻ ·ͱΊ
wϥϯΩϯάείΞτʔλϧΛϨίʔυʹ ॻ͍͓͚ͯൺֱత؆୯ʹ࡞ΕΔΑɻ wಉ͕ൃੜͨ࣌͠ͷϩδοΫΛॻ͘ͳΒςετ ͠Α͏Ͷɻ w·͋Γ্͕͍͍͔ͬͨ͠ɻʢࢮʣ ·ͱΊ
͓ΘΓ !UPN[PI ͓ΘΓ
༨ஊ
None
None
GPSUFFKQ ϑ Υ ϧ ς wΧϯϑΝϨϯεӡӦࢧԉπʔϧ wεϙϯαʔืू ٻॻ࡞ʢ.JTPDB࿈ܞʣ ϩΰड͚औΓ Ұ੪ϝʔ
ϧ εϙϯαʔҰཡ"1* wϓϩϙʔβϧืूʢ$G1ʣ બఆ λΠϜςʔϒϧΤσΟλ Ұ੪ϝʔϧ ϓϩϙʔβϧҰཡ"1* λΠϜςʔϒϧදࣔ w4MBDL࿈ܞͯ͠εϙϯαʔԠืϓϩϙʔβϧԠื࣌ʹօͰΓ্͕Δ wνέοτൢച࣌&WFOUCSJUF࿈ܞͯ͠ࢀՃऀऔΓࠐΈ 5XJUUFSΞΠί ϯऔΓࠐΈ 23ίʔυੜ $47μϯϩʔυ ͦͷ··ҹ͞Μʹೖߘͯ͠ΞΠίϯ໊͖ࡳ wͦͷଞػೳ͍Ζ͍ΖʢνϟϨϯδػೳ͋ΔΑʣ
GPSUFFKQ ϑ Υ ϧ ς wЌӡ༻த w·͍ͩʹ͔ͬͨ͘Γ͔Γʹ͍͘ͱ͜Ζ͋Δ wόάେͳ͘ͳͬͨ w୩ͷΓ߹͍ͷํͰ͋Εൺֱత ҆৺ͯ͑͠ΔͷͰ
͝૬ஊ͍ͩ͘͞