-
Notifications
You must be signed in to change notification settings - Fork 17
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
Create subclasses of JudgeTask for two JudgeTask actions #8033
Comments
1 task
ghost
assigned tomas-nava
Nov 30, 2018
ghost
added
the
In-Progress
label
Nov 30, 2018
va-bot
pushed a commit
that referenced
this issue
Dec 3, 2018
Connects #8033 ### Description Creates subclasses of JudgeTask for two actions. ### Acceptance Criteria - [ ] Code compiles correctly
4 tasks
Transformed existing rails c> JudgeReviewTask.count
# 1
rails c> JudgeReviewTask.first.update!(action: nil)
rails c> JudgeTask.where(type: JudgeTask.name).count
# 190
rails c> h = {}
rails c> JudgeTask.where(type: JudgeTask.name).each do |task|
h[task.action] = 0 unless h.keys.include?(task.action)
h[task.action] = h[task.action] + 1
end
# {"review"=>89, "assign"=>101}
rails c> JudgeTask.where(type: JudgeTask.name, action: nil).count
# 0
rails c> JudgeTask.where(action: nil).count
# 7
rails c> JudgeTask.where.not(action: nil).count
# 190 = 89 + 101. Great success!
rails c> h = {review: [], assign: [], bad: []}
rails c> JudgeTask.where(type: JudgeTask.name).each do |task|
case task.action
when "review"
h[:review] << task.id
task.update!(type: JudgeReviewTask.name)
when "assign"
h[:assign] << task.id
task.update!(type: JudgeAssignTask.name)
else
h[:bad] << task.id
end
end
rails c> h
# {:review=>[546, 572, 612, 558, 554, 737, 594, 567, 570, 575, 566, 581, 585, 565, 574, 545, 571, 548, 564, 584, 576, 543, 544, 539, 577, 573, 561, 568, 559, 560, 579, 578, 592, 607, 588, 589, 590, 611, 603, 586, 596, 601, 609, 751, 613, 563, 557, 587, 608, 604, 744, 748, 754, 745, 556, 743, 753, 742, 1432, 562, 606, 739, 580, 569, 1055, 1053, 1057, 1051, 550, 1050, 1183, 1218, 1227, 1244, 1431, 1250, 1220, 749, 1225, 1234, 1240, 1625, 1440, 1443, 1056, 552, 1253, 1215, 1839], :assign=>[1654, 1656, 1655, 1657, 1658, 1659, 1660, 582, 551, 547, 541, 583, 540, 542, 549, 599, 591, 595, 610, 1430, 752, 741, 747, 746, 750, 1433, 1435, 1436, 1437, 1439, 1442, 1444, 1448, 1441, 1446, 1445, 1447, 1438, 1052, 1049, 1059, 1048, 1047, 1061, 1434, 1054, 1060, 1058, 1219, 1221, 1226, 1216, 1228, 1241, 1229, 1230, 1235, 1236, 1238, 1239, 1233, 1243, 1223, 1237, 1231, 1232, 1224, 1217, 1247, 1251, 1254, 1255, 1257, 1258, 1259, 1249, 1256, 1245, 1248, 1252, 1246, 1222, 1653, 1758, 1759, 1760, 1761, 1754, 1755, 1756, 1757, 1753, 1752, 1762, 1763, 1764, 1242, 1844, 1847, 1921, 2014], :bad=>[]}
rails c> JudgeTask.where.not(action: nil).each { |task| task.update!(action: nil) }
rails c> JudgeTask.where.not(action: nil).count
# 0
rails c> JudgeTask.count
# 197 |
tomas-nava
pushed a commit
that referenced
this issue
Dec 5, 2018
Connects #8033 Co-authored-by: Lowell Wood <lowell@navahq.com>
tomas-nava
pushed a commit
that referenced
this issue
Dec 6, 2018
Also cleaned up some tests Connects #8033
ghost
removed
the
In-Progress
label
Dec 7, 2018
va-bot
pushed a commit
that referenced
this issue
Dec 7, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In order to remove the
action
column from thetasks
table, we need to move that information into the various Task models'label
methods. In order to support Task classes with multiple actions for a single class we will need to split those into separate classes. This ticket exists to do just that forJudgeTask
'sassign
andreview
actions (renamedJudgeAssignTask
andJudgeReviewTask
perhaps?).This will probably have to be a multi-part release so that we maintain support for existing
JudgeTask
s. I'd imagine something like the following:JudgeTask
s (create either of the two subclasses instead).JudgeTask
s in the database to the appropriate subclass.JudgeTask
that relies on theaction
property (should be handled by subclasses at this point).Acceptance criteria
JudgeTask
s no longer rely on thetasks.action
database columnThe text was updated successfully, but these errors were encountered: