add a function in class Collection to get the first view in the collection

Bug #1866148 reported by Cecilia Vela Gurovic
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Fix Released
Medium
Unassigned

Bug Description

So far, every time we need the first view of a collection as a View object, we get the views from the collection, get the id of the first and then create the View object

one idea:

adjust the function views() from Collection class to fetch first view and update the places in mahara to use it, something like

$view = $collection->views(0);

or

$view = $collection->views('first');

description: updated
Changed in mahara:
milestone: none → 20.04.0
Revision history for this message
Mahara Bot (dev-mahara) wrote : A patch has been submitted for review

Patch for "master" branch: https://reviews.mahara.org/10835

Changed in mahara:
status: New → In Progress
importance: Undecided → Medium
Revision history for this message
Mahara Bot (dev-mahara) wrote : A change has been merged

Reviewed: https://reviews.mahara.org/10835
Committed: https://git.mahara.org/mahara/mahara/commit/139c67fe6e1704a9e4e8f0fd86245f571e6a7a38
Submitter: Robert Lyon (<email address hidden>)
Branch: master

commit 139c67fe6e1704a9e4e8f0fd86245f571e6a7a38
Author: Rebecca Blundell <email address hidden>
Date: Mon Mar 23 16:31:34 2020 +1300

Bug 1866148: Add function first view in a collection code

behatnotneeded
Change-Id: I349f76b7808f29191c4b28249281decfe49f14ec

Revision history for this message
Robert Lyon (robertl-9) wrote :

Ended up being a new method on the collection class called first_view()

Changed in mahara:
status: In Progress → Fix Committed
Changed in mahara:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.