|
@@ 243-255 (lines=13) @@
|
| 240 |
|
"""Adapter in charge of Analysis Request sample action |
| 241 |
|
""" |
| 242 |
|
|
| 243 |
|
def __call__(self, action, objects): |
| 244 |
|
# Assign the Sampler and DateSampled |
| 245 |
|
transitioned = filter(lambda obj: self.set_sampler_info(obj), objects) |
| 246 |
|
if not transitioned: |
| 247 |
|
return self.redirect(message=_("No changes made"), level="warning") |
| 248 |
|
|
| 249 |
|
# Trigger "sample" transition |
| 250 |
|
transitioned = self.do_action(action, transitioned) |
| 251 |
|
if not transitioned: |
| 252 |
|
return self.redirect(message=_("No changes made"), level="warning") |
| 253 |
|
|
| 254 |
|
# Redirect the user to success page |
| 255 |
|
return self.success(transitioned) |
| 256 |
|
|
| 257 |
|
def set_sampler_info(self, sample): |
| 258 |
|
"""Updates the Sampler and the Sample Date with the values provided in |
|
@@ 316-328 (lines=13) @@
|
| 313 |
|
"""Adapter in charge of Analysis request schedule sampling action |
| 314 |
|
""" |
| 315 |
|
|
| 316 |
|
def __call__(self, action, objects): |
| 317 |
|
# Assign the scheduled Sampler and Sampling Date |
| 318 |
|
transitioned = filter(lambda obj: self.set_sampling_info(obj), objects) |
| 319 |
|
if not transitioned: |
| 320 |
|
return self.redirect(message=_("No changes made"), level="warning") |
| 321 |
|
|
| 322 |
|
# Trigger "schedule_sampling" transition |
| 323 |
|
transitioned = self.do_action(action, transitioned) |
| 324 |
|
if not transitioned: |
| 325 |
|
return self.redirect(message=_("No changes made"), level="warning") |
| 326 |
|
|
| 327 |
|
# Redirect the user to success page |
| 328 |
|
return self.success(transitioned) |
| 329 |
|
|
| 330 |
|
def set_sampling_info(self, sample): |
| 331 |
|
"""Updates the scheduled Sampling sampler and the Sampling Date with the |
|
@@ 279-291 (lines=13) @@
|
| 276 |
|
"""Adapter in charge of Analysis Request preserve action |
| 277 |
|
""" |
| 278 |
|
|
| 279 |
|
def __call__(self, action, objects): |
| 280 |
|
# Assign the Preserver and DatePreserved |
| 281 |
|
transitioned = filter(lambda obj: self.set_preserver_info(obj), objects) |
| 282 |
|
if not transitioned: |
| 283 |
|
return self.redirect(message=_("No changes made"), level="warning") |
| 284 |
|
|
| 285 |
|
# Trigger "preserve" transition |
| 286 |
|
transitioned = self.do_action(action, transitioned) |
| 287 |
|
if not transitioned: |
| 288 |
|
return self.redirect(message=_("No changes made"), level="warning") |
| 289 |
|
|
| 290 |
|
# Redirect the user to success page |
| 291 |
|
return self.success(transitioned) |
| 292 |
|
|
| 293 |
|
def set_preserver_info(self, sample): |
| 294 |
|
"""Updates the Preserver and the Date Preserved with the values provided |