This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
localhost [classroom_prod] # EXPLAIN ANALYZE SELECT * FROM knowledge_snapshots ks INNER JOIN answers a ON a.knowledge_snapshot_id = ks.id WHERE ks.student_id = 7538860; | |
QUERY PLAN | |
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | |
Nested Loop (cost=0.87..2899.01 rows=235 width=105) (actual time=0.095..5.197 rows=72 loops=1) | |
-> Index Scan using knowledge_snapshots_parent_student_id_created_at_idx on knowledge_snapshots ks (cost=0.43..95.05 rows=26 width=53) (actual time=0.047..0.086 rows=6 loops=1) | |
Index Cond: (student_id = 7538860) | |
-> Index Scan using answers_parent_knowledge_snapshot_id_idx on answers a (cost=0.44..106.56 rows=128 width=52) (actual time=0.838..0.845 rows=12 loops=6) | |
Index Cond: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
db-standby-1-prod [classroom_prod] # EXPLAIN ANALYZE SELECT "math_adaptive_assignment_sessions"."student_id", "math_adaptive_assignments"."domain_id", count (*) FROM "math_adaptive_assignments" INNER JOIN "math_adaptive_assignment_sessions" ON "math_adaptive_assignments"."id" = "math_adaptive_assignment_sessions"."assignment_id" INNER JOIN "knowledge_snapshots" ON "math_adaptive_assignment_sessions"."knowledge_snapshot_id" = "knowledge_snapshots"."id" INNER JOIN "answers" ON "knowledge_snapshots"."id" = "answers"."knowledge_snapshot_id" WHERE ("math_adaptive_assignment_sessions"."student_id" IN (7538860)) AND (("math_adaptive_assignment_sessions"."completed_at" >= '2017-09-08 08:00:00Z') AND (("math_adaptive_assignment_sessions"."completed_at" <= '2017-09-08 18:02:08.431692Z') AND ("answers"."correctness" >= 100.0))) GROUP BY "math_adaptive_assignment_sessions"."student_id", "math_adaptive_assignments"."domain_id"; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from PySide import QtGui | |
class DoubleSlider(QtGui.QSlider): | |
def __init__(self, *args, **kwargs): | |
super().__init__(*args, **kwargs) | |
# Set integer max and min. These stay constant. | |
super().setMinimum(0) | |
self._max_int = 10000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Regular expression to find floats. Match groups are the whole string, the | |
# whole coefficient, the decimal part of the coefficient, and the exponent | |
# part. | |
_float_re = re.compile(r'(([+-]?\d+(\.\d*)?|\.\d+)([eE][+-]?\d+)?)') | |
def valid_float_string(string): | |
match = _float_re.search(string) | |
return match.groups()[0] == string if match else False | |