open-learning-exchange / planet

🌍 Planet Learning - Angular application
https://hub.docker.com/r/treehouses/planet
GNU Affero General Public License v3.0
58 stars 37 forks source link

community: chat shared but not #7482

Open dogi opened 1 month ago

dogi commented 1 month ago
image
dogi commented 1 month ago
image
Mutugiii commented 1 month ago

On syncing with myPlanet the shared chat news item is overwritten removing the chat and news fields from the json

This is the json data on the item creation:

{
  "_id": "d24586bd93a7b393602df413353b06a9",
  "_rev": "1-3d6204245522ebc7a66c0dc2ddac4d3d",
  "docType": "message",
  "time": 1717785042000,
  "createdOn": "learning",
  "parentCode": "earth",
  "user": {
    "_id": "org.couchdb.user:demo",
    "_rev": "5-45eafbb5285562ce41be7a3d2339168e",
    "name": "demo",
    "firstName": "demo",
    "lastName": "learner",
    "middleName": "",
    "email": "demo@user.com",
    "phoneNumber": "(702)-234-5566",
    "roles": [
      "learner"
    ],
    "isUserAdmin": false,
    "joinDate": 1717098653000,
    "planetCode": "learning",
    "parentCode": "earth",
    "language": "English",
    "level": "Beginner",
    "birthDate": "2005-08-15T21:00:00.000Z",
    "gender": "female",
    "betaEnabled": false,
    "type": "user",
    "_attachments": {
      "img": {
        "content_type": "image/png",
        "revpos": 3,
        "digest": "md5-QT1YBUyJ7dL7xIswhtLJqg==",
        "length": 318597,
        "stub": true
      }
    }
  },
  "news": {
    "_id": "d24586bd93a7b393602df41335175fb7",
    "_rev": "6-32523bb9a3d95a37f0fa78b05bd33052",
    "aiProvider": "openai",
    "user": "demo",
    "conversations": [
      {
        "query": "tell me about open learning exchange and olpc and ole nepal",
        "response": "Open Learning Exchange (OLE) is a non-profit organization that focuses on providing quality education to underserved communities around the world through innovative technology and pedagogy. OLE believes in the power of open educational resources and digital tools to improve access to education for all, regardless of geography or socio-economic status.\n\nOne Laptop Per Child (OLPC) is a project initiated by OLE that aims to provide children in developing countries with low-cost, rugged laptops designed for educational purposes. These laptops are equipped with educational software and tools that encourage collaboration, creativity, and critical thinking skills.\n\nOLE Nepal is a local chapter of Open Learning Exchange that focuses on improving the quality of education in Nepal through the integration of technology in classrooms. OLE Nepal provides training and support to teachers to effectively use digital tools in their teaching practices, and develops interactive digital content in collaboration with local educators and experts.\n\nOverall, the goal of OLE and OLPC is to empower children with the knowledge and skills they need to succeed in the 21st century, and to bridge the digital divide by providing equal access to education for all."
      },
      {
        "query": "how and when did they work together",
        "response": "OLE Nepal and OLPC have worked together in collaboration since 2008 when OLPC's founder, Nicholas Negroponte, visited Nepal and met with OLE Nepal's team. Both organizations shared a common goal of leveraging technology to improve education outcomes for children in developing countries. \n\nThe partnership between OLE Nepal and OLPC resulted in the deployment of XO laptops in schools across Nepal, providing students with access to interactive educational content and tools to enhance their learning experience. OLE Nepal's expertise in curriculum development and teacher training complemented OLPC's hardware and software capabilities, creating a comprehensive education program for schools in Nepal.\n\nSince then, OLE Nepal and OLPC have continued to collaborate on various projects and initiatives to support education reform in Nepal. Their partnership has successfully impacted thousands of students and teachers by providing them with access to quality education resources and technology tools."
      }
    ],
    "title": "ole, olpc and ole nepal",
    "createdDate": 1717102730203,
    "updatedDate": 1717703157000
  },
  "message": "</br>",
  "chat": true,
  "messageType": "sync",
  "viewIn": [
    {
      "_id": "learning@earth",
      "section": "community",
      "sharedDate": 1717785042000
    }
  ],
  "images": []
}

Post sync the json looks like this:

{
  "_id": "d24586bd93a7b393602df4133537675e",
  "_rev": "11-15e78afbe9d57eb352e48c342021aa8e",
  "message": "</br>",
  "time": 1717703195000,
  "createdOn": "learning",
  "docType": "message",
  "viewIn": [
    {
      "_id": "learning@earth",
      "section": "community",
      "sharedDate": 1717703195000
    }
  ],
  "avatar": "",
  "messageType": "sync",
  "messagePlanetCode": "",
  "replyTo": "",
  "parentCode": "earth",
  "images": [],
  "labels": [],
  "user": {
    "_id": "org.couchdb.user:demo",
    "_rev": "5-45eafbb5285562ce41be7a3d2339168e",
    "name": "demo",
    "firstName": "demo",
    "lastName": "learner",
    "middleName": "",
    "email": "demo@user.com",
    "phoneNumber": "(702)-234-5566",
    "roles": [
      "learner"
    ],
    "isUserAdmin": false,
    "joinDate": 1717098653000,
    "planetCode": "learning",
    "parentCode": "earth",
    "language": "English",
    "level": "Beginner",
    "birthDate": "2005-08-15T21:00:00.000Z",
    "gender": "female",
    "betaEnabled": false,
    "type": "user",
    "_attachments": {
      "img": {
        "content_type": "image/png",
        "revpos": 3,
        "digest": "md5-QT1YBUyJ7dL7xIswhtLJqg==",
        "length": 318597,
        "stub": true
      }
    }
  }
}
Mutugiii commented 1 month ago

To display the shared chat in the news, we added 2 new fields

chat -> boolean. sets the Shared Chat label and identify a shared chat item news -> holds the chat conversations