1
0
forked from PGL/Clyde

Compare commits

...

5 Commits

10 changed files with 24 additions and 16 deletions

View File

@ -28,8 +28,9 @@ public class ResearchDTO {
private Access access;
private String domain;
private String summary;
private long views;
private ResearchDTO(String title, ResearcherDTO researcherDTO, Date releaseDate, PaperType paperType, String pdfLocation, String language, Access access, String domain, String summary, long id) {
private ResearchDTO(String title, ResearcherDTO researcherDTO, Date releaseDate, PaperType paperType, String pdfLocation, String language, Access access, String domain, String summary, long id,long views) {
this.title = title;
this.researcher = researcherDTO;
this.releaseDate = releaseDate;
@ -40,12 +41,13 @@ public class ResearchDTO {
this.domain = domain;
this.summary = summary;
this.id = id;
this.views = views;
}
public static ResearchDTO construct(Research research){
return new ResearchDTO(research.getTitle(), ResearcherDTO.construct(research.getAuthor()), research.getReleaseDate(),
research.getPaperType(),research.getPdfLocation(),research.getLanguage(),research.getAccess(),
research.getDomain(), research.getSummary(), research.getId());
research.getDomain(), research.getSummary(), research.getId(), research.getViews());
}
}

View File

@ -47,6 +47,7 @@ public class ApplicationsController {
//if unAuthed
authorizedApps.add(Applications.Login);
authorizedApps.add(Applications.ResearcherProfile);
User user = authServ.getUserFromToken(token);
if(user == null)

View File

@ -141,7 +141,7 @@ public class MockController {
Researcher output = researchesService.saveResearcher(jojoResearcherAccount);
Research jojoResearch = new Research("Graphs : Advanced Search Algorithms", output, new Date(0),
PaperType.Article, "here.pdf", null, "english",
PaperType.Article, "test.pdf", null, "english",
Access.OpenSource, "IT", "This Article's title speaks for itself \n We'll discuss about advanced Graph search Algorithms");
Research restrictedResearch = new Research("just another Name", output, new Date(1111111111),

View File

@ -229,7 +229,7 @@ public class ResearchController {
///////
//views part
@PostMapping("/addView/{url}")
@PostMapping("/addview/{url}")
public ResponseEntity<ResearchDTO> addView(@PathVariable String url){
Research research = researchesServ.getResearchByUrl(url);
if (research ==null) return new ResponseEntity<>(HttpStatus.NOT_FOUND);

View File

@ -19,22 +19,22 @@ public interface StatsRepository extends CrudRepository<Research,Long> {
Iterable<Map<String ,Integer>> viewsByTopics();
@Query("select new map(r.domain as label, count(r.language) as y) from Research r group by r.domain")
@Query("select new map(r.domain as label, count(distinct r.language) as y) from Research r group by r.domain")
Iterable<Map<String ,Integer>> languageByTopics();
@Query("select new map(to_char(r.releaseDate,'YYYY') as label, count(r.language) as y) from Research r group by to_char(r.releaseDate,'YYYY')")
@Query("select new map(to_char(r.releaseDate,'YYYY') as label, count(distinct r.language) as y) from Research r group by to_char(r.releaseDate,'YYYY')")
Iterable<Map<String ,Integer>> languageByYears();
@Query("select new map(to_char(r.releaseDate, 'month') as label, count(r.language) as y) from Research r group by to_char(r.releaseDate, 'month')")
@Query("select new map(to_char(r.releaseDate, 'month') as label, count(distinct r.language) as y) from Research r group by to_char(r.releaseDate, 'month')")
Iterable<Map<String ,Integer>> languageByMonths();
@Query("select new map(to_char(r.releaseDate,'YYYY') as label, count(r) as y) from Research r group by to_char(r.releaseDate,'YYYY')")
@Query("select new map(to_char(r.releaseDate,'YYYY') as label, count(distinct r) as y) from Research r group by to_char(r.releaseDate,'YYYY')")
Iterable<Map<String ,Integer>> researchesByYears();
@Query("select new map(r.domain as label, count(r) as y) from Research r group by r.domain")
@Query("select new map(r.domain as label, count(distinct r) as y) from Research r group by r.domain")
Iterable<Map<String ,Integer>> researchesByTopics();
@Query("select new map(to_char(r.releaseDate, 'month') as label, count(r) as y) from Research r group by to_char(r.releaseDate, 'month')")
@Query("select new map(to_char(r.releaseDate, 'month') as label, count(distinct r) as y) from Research r group by to_char(r.releaseDate, 'month')")
Iterable<Map<String ,Integer>> researchesByMonth();
}

View File

@ -19,5 +19,7 @@ public enum Applications {
// InscriptionService authorization
Requests,
// profile of a researcher
ResearcherProfile,
StudentsList
}

View File

@ -22,7 +22,7 @@ function format(date){
}
const emit = defineEmits(["downloadPdf","downloadBibTex"]);
const emit = defineEmits(["modal-close","downloadPdf","downloadBibTex"]);
const target = ref(null)
onClickOutside(target, ()=>emit('modal-close'))
@ -42,6 +42,7 @@ onClickOutside(target, ()=>emit('modal-close'))
<li>Language : {{article.language}}</li>
<li>PaperType : {{article.paperType}}</li>
<li>Domain : {{article.domain}}</li>
<li>Views : {{article.views}}</li>
<li>Access : {{article.access}}</li>
</ul>
<div id="downloads" v-if="article.pdfLocation !== null">

View File

@ -117,10 +117,10 @@ function update(){
fontColor: "white",
text: statsOf.value + " By "+ statsBy.value,
}
const index = (0 ?statsOf.value === "views": 3 ? statsOf.value === "researches":6) + (0?statsBy.value ==="years":1?statsBy.value==="months":2)
let index = (statsOf.value === "views"?0:(statsOf.value === "researches"?3:6)) + (statsBy.value ==="years"?0:(statsBy.value==="months"?1:2))
options.data[0].dataPoints = stats.value[index]
if (statsOf.value !== "" && statsBy.value !== "")
options.data[0].dataPoints = stats.value[index]
options.title.text = statsOf.value + " By "+ statsBy.value;

View File

@ -12,9 +12,10 @@ export async function fetchStats(id){
return restGet("/stats/" +id)
}
export async function addView(url){
return restPost("/addView/" +url)
return restPost("/addview/" +url)
}
export async function getFile(url){
return restGet("/" + url)
const restURL = import.meta.env.VITE_CLYDE_MODE === 'container' ? "http://localhost:8000": import.meta.env.DEV ? "http://localhost:5173" : "https://clyde.herisson.ovh/api"
await fetch(restURL + "/"+url, {method: "GET"})
}

View File

@ -34,6 +34,7 @@ const appsList = {
'ManageCourses': { path: '#/manage-courses', icon: 'fa-book', text: i18n("app.manage.courses") },
'StudentsList':{ path: '#/students-list',icon: 'fa-users',text: i18n("app.studentList")},
'UsersList':{ path: '#/users-list',icon: 'fa-users',text: i18n("app.users")},
'ResearcherProfile':{path:'#/researcher-profile',icon:'fa-book-bookmark',text:"hihi"},
}
const currentPath = ref(window.location.hash)