aboutsummaryrefslogtreecommitdiffstats
path: root/script/user-use-graph
diff options
context:
space:
mode:
authorGareth Rees <gareth@mysociety.org>2015-05-15 13:16:48 +0100
committerGareth Rees <gareth@mysociety.org>2015-06-04 13:51:18 +0100
commit0024aaef7547bb1657b51572f1c072e10db2d1e4 (patch)
tree99382c63ce1495345759ea260a62afd8a93ff048 /script/user-use-graph
parent98cf36fe876725a7ed8a11d5291e923f698ec5ae (diff)
Avoid loading associations to check existence
Calling InfoRequestEvent#is_X? loads the associated model from the database. We don't need to do this to check what 'type' the event is. This commit first checks whether there is an association_id – if there is then we know it's that 'type'. If there's no association_id, call the association to check whether one has been added but not yet persisted. Only check association if the object is a new record. This avoids checking the association on a persisted record when we know it isn't that type of event due to the database record not existing.
Diffstat (limited to 'script/user-use-graph')
0 files changed, 0 insertions, 0 deletions