If this is only happened when adding prayers, it should be fine. Never
mind. Typically front end could consider the content is changed if there is
keyboard event in that textfield. but yes, if we want to know the id, we
need to store it somewhere. Nevermind, we could just leave it as is now.


2014-04-18 11:32 GMT-07:00 lty419 <notifications@github.com>:

> In application/models/prayer_model.php:
>
> > +    		$scriptureQuery = $this->db->get_where($this->
> scriptureTable, array('date' => $maxDate));
> > +    		return $scriptureQuery->row_array();
> > +    	}
> > +    	return null;
> > +    }
> > +
> > +    /**
> > +     * get_prayerItem
> > +     *
> > +     * Check if the given description already exists as a prayer item, if it does return the row,
> > +     * otherwise return null.
> > +     *
> > +     */
> > +    function get_prayerItem($description)
> > +    {
> > +    	$itemQuery = $this->db->get_where($this->itemTable, array('description' => $description));
>
> How do we do the verification in front end? We send down only html but not
> data so there is no original string to compare with after user change it.
> Currently I am using a hidden input to submit section id, if we want to
> bring back more info like id we have to either add one more hidden input or
> use some format we have to parse on server. I mean, I thought about that...
> but since our app is not write-intensive I guess the perf hit to db is
> acceptable. Let me know if there is better alternative solution. Tianyu
> … <#145761c7e7d61c3c_>
> On Fri, Apr 18, 2014 at 11:22 AM, leirocky <notifications@github.com>
> wrote: In application/models/prayer_model.php: > + $scriptureQuery =
> $this->db->get_where($this-> scriptureTable, array('date' => $maxDate)); >
> + return $scriptureQuery->row_array(); > + } > + return null; > + } > + > +
> /** > + * get_prayerItem > + * > + * Check if the given description already
> exists as a prayer item, if it does return the row, > + * otherwise return
> null. > + * > + */ > + function get_prayerItem($description) > + { > +
> $itemQuery = $this->db->get_where($this->itemTable, array('description' =>
> $description)); If description is a long string, this will take long time
> to query. it is better to just insert this one as a new item. or you could
> do this verification in the front end. or remember the id and use id to
> query if user doesn't change the content. — Reply to this email directly or
> view it on GitHub<
> https://github.com/Triassic/XiaoLongBao/pull/98/files#r11781633> .
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/Triassic/XiaoLongBao/pull/98/files#r11782034>
> .
>