API Merge: Merged get functions with and without id

No, that's not how it works now - if I pass a course id, it will not match
anything else - hence two different clauses.


On Mon, Jul 14, 2014 at 7:39 PM, Alexey Novak <notifications@github.com>
wrote:

> In api/courses/router_classes.php:
>
> >          $clause = create_SQL_clause(array(
> >              "c.title" => $_GET["title"],
> >              "c.cat_id" => $_GET["category_id"],
> >              "c.primary_language" => $_GET["primary_language"]
> >          ));
> >
> > -        $query = "SELECT c.course_id, c.cat_id, cc.cat_name, c.created_date, ".
> > -            "c.title, c.description, c.notify, c.copyright, c.icon, c.release_date, c.primary_language, ".
> > -            "c.end_date, c.banner FROM %scourses c ".
> > -            "INNER JOIN %scourse_cats cc ON c.cat_id = cc.cat_id ".$clause;
> > -
> > -        $array = array(TABLE_PREFIX, TABLE_PREFIX);
> > -
> > -        api_backbone(array(
> > -            "request_type" => HTTP_GET,
> > -            "access_level" => TOKEN_ACCESS_LEVEL,
> > -            "query" => $query,
> > -            "query_array" => $array
> > +        $clause_with_id = create_SQL_clause(array(
>
> I think instead of having 2 different $clause variables just have only 1.
> The input array will change depending on if $course_id is passed. Then you
> can always add this one $clause variable to your $query one and use it.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/sdaityari/ATutor/pull/26/files#r14879008>.
>



-- 
Shaumik Daityari,
Integrated M. Tech. (5th year),
Geological Technology,
Department of Earth Sciences,
Indian Institute of Technology Roorkee,
Uttarakhand