center-for-knowledge-communication / mathspring

Mathspring website
http://mathspring.org
6 stars 3 forks source link

Remove/fix all references to probstdmap #106

Closed perspegrity5 closed 4 years ago

perspegrity5 commented 4 years ago

that the probstdmap table is obsolete and should never be used in any code (MS or teacher tools)--its use should be replaced by using problem.standardID. (We used to allow for multi standards per problem but now only one). It is being used somewhere in the teacher tools at least (inferred from a bug report).

FrankSylvia commented 4 years ago

probstdmap if used in the 6 files below.

C:\WPI\TEST\MathSpring\src\edu\umass\ckc\wo\cache\ProblemMgr.java (3 hits) Line 755: "ProbStdMap std where p.id = std.probID and d.problemId = p.id and p.status='ready' and std.stdId in "; Line 780: "ProbStdMap std where p.id = std.probID and d.problemId = p.id and p.status='ready' and std.stdId in "; Line 806: String q = "select m.stdid, count(m.probId) from probstdmap m, problem p where m.probid=p.id and p.status='ready' group by m.stdid"; C:\WPI\TEST\MathSpring\src\edu\umass\ckc\wo\db\DbCC.java (1 hit) Line 91: String q = "select probId,stdId from probstdmap where stdId=?"; C:\WPI\TEST\MathSpring\src\edu\umass\ckc\wo\db\DbProblem.java (1 hit) Line 761: String q = "select s.id,s.description,s.category,s.grade,s.idABC from probstdmap m, standard s where m.probid=? and s.id=m.stdid"; C:\WPI\TEST\MathSpring\src\edu\umass\ckc\wo\ttmain\ttservice\util\TTUtil.java (5 hits) Line 71: public static final String PER_STANDARD_QUERY_FIRST = "select distinct(std.clusterId),cc.categoryCode,cc.clusterCCName,cc.displayName,count(distinct(h.problemId)) as noOfProblemsInCluster ,SUM((h.numHints)) as totalHintsViewedPerCluster from studentproblemhistory h, standard std, probstdmap map, cluster cc where studid in (select id from student where classId=(:classId)) and std.clusterID = cc.id and h.mode != 'demo' and std.id=map.stdId and map.probId=h.problemId group by std.clusterID"; Line 72: public static final String PER_STANDARD_QUERY_SECOND = "select std.clusterId,count(distinct(h.problemId)) as noOfProblems from studentproblemhistory h, standard std, probstdmap map where studid in (select id from student where classId =(:classId)) and mode='practice' and std.id=map.stdId and map.probId=h.problemId and h.numAttemptsToSolve = 1 group by std.clusterID"; Line 73: public static final String PER_STANDARD_QUERY_THIRD = "select distinct(h.problemId),pr.name,pr.standardID, pr.standardCategoryName,pr.screenShotURL,std.description from studentproblemhistory h, standard std, probstdmap map,problem pr where studid in (select id from student where classId=(:classId)) and std.clusterID=(:clusterID) and mode='practice' and std.id=map.stdId and map.probId=h.problemId and h.problemId = pr.id"; Line 74: public static final String PER_STANDARD_QUERY_FOURTH = "SELECT FROM (select std.clusterId,count(h.effort) as totalSOFLogged from studentproblemhistory h, standard std, probstdmap map where studid in (select id from student where classId =(:classId)) and mode='practice' and std.id=map.stdId and map.probId=h.problemId and h.effort = 'SOF' and h.effort != 'null' group by std.clusterID) as A join ( select std.clusterId,count(h.effort) as totoaleffortlogged from studentproblemhistory h, standard std, probstdmap map where studid in (select id from student where classId =(:classId)) and mode='practice' and std.id=map.stdId and map.probId=h.problemId and h.effort != 'null' group by std.clusterID) as B on A.clusterId=B.clusterId"; Line 74: public static final String PER_STANDARD_QUERY_FOURTH = "SELECT FROM (select std.clusterId,count(h.effort) as totalSOFLogged from studentproblemhistory h, standard std, probstdmap map where studid in (select id from student where classId =(:classId)) and mode='practice' and std.id=map.stdId and map.probId=h.problemId and h.effort = 'SOF' and h.effort != 'null' group by std.clusterID) as A join ( select std.clusterId,count(h.effort) as totoaleffortlogged from studentproblemhistory h, standard std, probstdmap map where studid in (select id from student where classId =(:classId)) and mode='practice' and std.id=map.stdId and map.probId=h.problemId and h.effort != 'null' group by std.clusterID) as B on A.clusterId=B.clusterId"; C:\WPI\TEST\MathSpring\src\edu\umass\ckc\wo\woreports\PerStandardClassSummaryReport.java (1 hit) Line 75: String q = "select h.problemId, h.numHints,h.numMistakes,h.numAttemptsToSolve,h.timeToFirstHint,h.timeToFirstAttempt,std.clusterId from studentproblemhistory h, standard std, probstdmap map where studid in (select id from student where classId = ?) and mode='practice' and std.id=map.stdId and map.probId=h.problemId"; C:\WPI\TEST\MathSpring\src\edu\umass\ckc\wo\woreports\ProblemDifficultyReport.java (1 hit)

FrankSylvia commented 4 years ago

In MathSpring\src\edu\umass\ckc\wo\cache\ProblemMgr.java I found this function which seems to be only used by a restful service class.

Does anyone know if it is still in use? If yes, I'm not sure what it's purpose is so that I can re-write it.

public static List<Pair<String,Integer>> getAllStandardNumProblems(Connection conn) throws SQLException {
    ResultSet rs=null;
    PreparedStatement stmt=null;
    try {
        List<Pair<String,Integer>> res = new ArrayList<Pair<String,Integer>>();

        String q = "select m.stdid, count(m.probId) from probstdmap m, problem p where m.probid=p.id and p.status='ready' group by m.stdid";

        stmt = conn.prepareStatement(q);
        rs = stmt.executeQuery();
        while (rs.next()) {
            String std= rs.getString(1);
            int num = rs.getInt(2);
            if (std != null)
                res.add(new Pair(std,num));
        }
        return res;
    }
    finally {
        if (stmt != null)
            stmt.close();
        if (rs != null)
            rs.close();
    } 
}
perspegrity5 commented 4 years ago

Hi Frank,

I don't usually have much useful to say on the 'deep code' questions (sorry)--I can't help figure out what this code refers to. But whatever it is used for, it seems possible to change the db query to return the standardIDs from the problem instead of the probstdmap table (doing this anywhere probstdmap is referenced). Is this code in MS code or TeacherTool code? What functions call it?

Also, looking at the code here, it seems like it is returning only the number of problems in each standard, and is not returning what those problems are. My quess is that the query should say:

String q = "select p.standardID, count(p.Id) from problem p where p.status='ready' group by p.standardID";

--T

On May 13, 2020, at 11:40 AM, FrankSylvia notifications@github.com wrote:

In MathSpring\src\edu\umass\ckc\wo\cache\ProblemMgr.java I found this function which seems to be only used by a restful service class.

Does anyone know if it is still in use? If yes, I'm not sure what it's purpose is so that I can re-write it.

public static List<Pair<String,Integer>> getAllStandardNumProblems(Connection conn) throws SQLException { ResultSet rs=null; PreparedStatement stmt=null; try { List<Pair<String,Integer>> res = new ArrayList<Pair<String,Integer>>();

    String q = "select m.stdid, count(m.probId) from probstdmap m, problem p where m.probid=p.id and p.status='ready' group by m.stdid";

    stmt = conn.prepareStatement(q);
    rs = stmt.executeQuery();
    while (rs.next()) {
        String std= rs.getString(1);
        int num = rs.getInt(2);
        if (std != null)
            res.add(new Pair(std,num));
    }
    return res;
}
finally {
    if (stmt != null)
        stmt.close();
    if (rs != null)
        rs.close();
} 

} — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/center-for-knowledge-communication/mathspring/issues/106#issuecomment-628074517, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABPNL7LQID4XHRZUG4M3PJ3RRK5O7ANCNFSM4M4HDEWQ.

===---===---===---===---===---===---===---===---===---===---===---===---===---===---===---===---===---=== Tom Murray, EdD

Knowing and Unknowing Reality (read it here http://knowingandunknowingreality.com/)

Chief Visionary and Instigator @ Open Way Solutions — www.openwaysolutions.com http://www.openwaysolutions.com/ Senior Research Fellow in Cognitive Tools, Educational Technology & E-Dialogue @ UMass Amherst — www.tommurray.us http://www.tommurray.us/ 36 Fruit Street, Northampton MA 01060; phone: is413-then-695-and-2800.